Performance...
08.04.2006 00:16:56
windalf
ich habe mir eine kleine eigene Pivotauswertung gebastelt und wüsste gerne wie ich da Geschwindigkeit reinbekomme...
Es geht mir jetzt nicht darum schon öfter mal berechnete Werte irgendwie schlau vorzumerken sondern einfach nur den code bezüglich Durchlaufgeschindigkeit zu optiemieren.
Function Auswertung(ws_name As String, spalte As String, werk As String, Komponente As String) As Long
Dim sum As Long
Dim ws As Worksheet
Dim i As Long, j As Long, von_spalte As Long, bis_spalte As Long
Set ws = Worksheets(ws_name)
sum = 0
von_spalte = Left(spalte, 1)
bis_spalte = Right(spalte, 1)
j = 2
While ws.Cells(j, 1).Value <> ""
For i = von_spalte To bis_spalte
If werk = "" Or ws.Cells(j, 1).Value = werk Then
If Komponente = "" Or ws.Cells(j, 3).Value = Komponente Then
sum = sum + ws.Cells(j, i + 3).Value
End If
End If
Next i
j = j + 1
Wend
Auswertung = sum
End Function
Danke für Tips
Gruß Windi