https://www.herber.de/bbs/user/124289.xlsb
Ich möchte gerne Spalte D in Blöcken summieren in Abhängigkeit von Zahlen in Spalte B.
Hat jemand einen Tipp für mich? Gerne auch mit Hilfsspalte.
Gruß
Klaus
Sub summieren()
Dim x As Integer
Dim Zähler As Integer
With Sheets("Blatt1")
For Zähler = 4 To .Cells(Rows.Count, 2).End(xlUp).Row
x = .Cells(Zähler, 2).Value
If x = 1 Then
y = y + .Cells(Zähler, 4)
End If
If x = 2 Then
y = y + .Cells(Zähler, 4)
End If
If x = 3 Then
y = y + .Cells(Zähler, 4)
End If
If x = 4 Then
y = y + .Cells(Zähler, 4)
End If
If x = 5 Then
y = y + .Cells(Zähler, 4)
End If
If x = 6 Then
y = y + .Cells(Zähler, 4)
End If
If x = 7 Then
y = y + .Cells(Zähler, 4)
End If
Next Zähler
.Cells(35, 4).Value = y
End With
End Sub