Hirdetés

Keresés

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

  • Declare

    őstag

    válasz Fferi50 #31862 üzenetére

    :R Tuti, most mar kiirja a szumm függvenyt, köszönöm :R

    Viszont, most kiprobaltam konkret szamokkal is es nem jo valami :B

    Szoval ez a teljes kod:

    Sub FormatText()
    Dim i As Integer
    For i = 1 To Range("A" & "55").End(xlUp).Row Step 1
    If Application.WorksheetFunction.CountIf(Range("H" & i & ":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


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

    End If
    Next i
    End Sub

    az "On Error..." tol indul, amit irtal. Azzal valami gubanc van.

    Szoval azt kellene csinalnia, hogy amelyik sorban megtalalta a "w" erteket a "H" oszlopban, annak a sornak az "F" cellajaba szummazza az "F" oszlop cellainak ertekeit felfele, egeszen addig, amig "p" erteket nem talal a "H" oszlopban.

    Aztan megy tovabb, megint talal egy "w" erteket, formaz, szummaz felfele....ez igy blokkonkent nagyon sokszor :)

    Vagy valahogy mashogy kellene, hogy a "p" ertekek az I oszlopban legyenek mondjuk? :F

    Aztan lassan befejezem, mert nem akarom teljesen kisajatitani a topicot :B

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