Mittels folgendem Code versuche ich eine ListBox zu befüllen!
Dim Year As Date
With frmSparbücher
.ListBox1.Clear
i = 0
For lng = 4 To 1000
If Year(Sheets("Kontoführung").Cells(lng, 720)) = CDbl(cbJahr) Then
.ListBox1.AddItem Sheets("Kontoführung").Cells(lng, 720).Value
.ListBox1.Column(1, i) = Sheets("Kontoführung").Cells(lng, 721).Text
.ListBox1.Column(2, i) = Sheets("Kontoführung").Cells(lng, 722).Text
.ListBox1.Column(3, i) = Sheets("Kontoführung").Cells(lng, 723).Text
.ListBox1.Column(4, i) = Sheets("Kontoführung").Cells(lng, 724).Text
.ListBox1.Column(5, i) = Sheets("Kontoführung").Cells(lng, 725).Text
.ListBox1.Column(6, i) = Sheets("Kontoführung").Cells(lng, 726).Text
.ListBox1.Column(7, i) = Sheets("Kontoführung").Cells(lng, 727).Text
.ListBox1.Column(8, i) = lng
i = i + 1
End If
Next
End With
Das fettgedruckte "Year" wird bei Auslösung des Makros immer markiert und es kommt die Fehlermeldung: Fehler beim Kompilieren: Erwartet: Datenfeld
Was zum Teufel mache ich wieder einmal falsch? Wer kann mir bitte helfen? Schon jetzt Danke!
Gruß Frank H.