VBA -- Value
20.02.2017 14:55:21
Fred Neumann
Hallo Excel-Experten,
Ich nutze ein vba, welches u.a. Daten aus Tabelle Basis mit Tabelle Import vergleicht und entsprechend Import ergänzt.
Das Problem:
Wird passende Daten in Import festgestellt die zu übertragenden Felder in "Basis" allerdings leer sind, wird entsprechend eine Null eingetragen (anstatt leere Zelle)
Dim ArrayB() As Variant
Dim ArrayL1() As Variant
Dim WSB As Worksheet
Dim WSL1 As Worksheet
Dim r As Long, rr As Long
Dim Ende As Long
Worksheets("Import").Range("D6:G15000").ClearContents
Set WSB = ThisWorkbook.Worksheets("Basis")
Set WSL1 = ThisWorkbook.Worksheets("Import")
ArrayB = WSB.Range("A1:I15000").Value
ArrayL1 = WSL1.Range("A6").CurrentRegion.Resize(, 7)
For r = LBound(ArrayL1, 1) + 1 To UBound(ArrayL1, 1)
For rr = LBound(ArrayB, 1) + 1 To UBound(ArrayB, 1)
If ArrayL1(r, 2) & ArrayL1(r, 3) = ArrayB(rr, 3) & ArrayB(rr, 4) Then
ArrayL1(r, 4) = ArrayL1(r, 4) + ArrayB(rr, 5)
ArrayL1(r, 5) = ArrayL1(r, 5) + ArrayB(rr, 6)
ArrayL1(r, 6) = ArrayL1(r, 6) + ArrayB(rr, 8)
ArrayL1(r, 7) = ArrayL1(r, 7) + ArrayB(rr, 9)
End If
Next
Next
WSL1.Range("A1").Resize(UBound(ArrayL1, 1), UBound(ArrayL1, 2)) = ArrayL1
Könnte mir jemand eventuell dieses VBA korrigieren, so das anstatt die Null nichts eingetragen wird?
mfG
Fred