Probleme mit SumIf
07.07.2016 22:31:31
PQuest
ich verwende u.a. folgenden Code
With wsZiel
.Cells(lngLastRowZ + 1, 11).Value = "Gesamtsumme Eingang:"
.Cells(lngLastRowZ + 1, 12) = Application.WorksheetFunction.SumIf(Range("G5:G" & lngLastRowZ), "" & "", Range("L5:L" & lngLastRowZ))
.Cells(lngLastRowZ + 2, 11).Value = "Gesamtsumme Ausgang:"
.Cells(lngLastRowZ + 2, 12).Value = Application.WorksheetFunction.SumIf(Range("H5:H" & lngLastRowZ), "0", Range("L5:L" & lngLastRowZ))
.Cells(lngLastRowZ + 3, 11).Value = "Lagerwert:"
.Cells(lngLastRowZ + 3, 12).Value = .Cells(lngLastRowZ + 1, 12) - .Cells(lngLastRowZ + 2, 12)
Set Rng = .Range(.Cells(lngLastRowZ + 1, 11), .Cells(lngLastRowZ + 3, 11))
With Rng
.Font.Bold = True
.HorizontalAlignment = xlRight
End With
Set Rng = .Range(.Cells(lngLastRowZ + 1, 12), .Cells(lngLastRowZ + 3, 12))
With Rng
.Font.Bold = True
End With
.Columns("M:M").EntireColumn.Delete
.Columns("J:J").EntireColumn.Delete
.Columns("C:E").EntireColumn.Delete
.Columns("A:H").EntireColumn.AutoFit
End With
Leider werfen mir die SumIf Funktionen als Ergebnis immer 0 aus. Alles andere funktioniert einwandfrei.
Erkennt jemand meinen Fehler?
Gruß,
PQuest