Új hozzászólás Aktív témák

  • bsasa1

    csendes tag

    válasz Declare #31864 üzenetére

    Szia, nálam így működik:

    Sub FormatText()

    Dim i As Integer

    For i = 1 To Range("A55").End(xlUp).Row
    If Application.WorksheetFunction.CountIf(Range("H" & i), "w") > 0 Then
    Range("A" & i & ":H" & i).Select
    Selection.Font.Name = "Calibri"
    Selection.Font.FontStyle = "Italic"
    Selection.Font.Underline = xlUnderlineStyleSingle
    Range("E" & i).Value = Range("A" & i).Value & " " & Range("D" & i).Value
    Range("E" & i).HorizontalAlignment = xlRight
    Range("A" & i & ":D" & i).ClearContents
    End If

    On Error Resume Next
    If Range("H" & i).Value = "p" Then Range("F" & i).Formula = "=Sum(" & Range("F" & Range("H1:H" & i - 1).Find(what:="p", LookIn:=xlValues, SearchDirection:=xlPrevious, lookat:=xlWhole).Row + 1).Address & ":" & Range("F" & i - 1).Address & ")"
    If Err <> 0 Then If Range("H" & i).Value = "p" Then Range("F" & i).Formula = "=Sum(" & Range("F1:F" & i - 1).Address & ")"
    On Error GoTo 0


    Next i

    End Sub

    De pl ha az első sorban van a "p", vagy több van egymás után akkor azt nem tudja túl jól kezelni.

Új hozzászólás Aktív témák