um es gleich vorne weg zu nehmen, ich habe mich noch nie so richtig mit Array beschäftig. Nun stehe ich aber vor dem Problem das ich in eine Listbox, mit AddItem, mehr als 10 Spalten bringen muss. Die Daten werden aus einer anderen Tabelle eingesammelt. Bisher habe ich es so gelöst:
With Workbooks("RWG_Daten.xlsx").Sheets("RWG")
lc = 12 'Zähler für ListCount um die entsprechende Monatzzahl abzuziehen
For a = 1 To 12
If Len(a) = 2 Then
strtext = "*." & a & "." & Year(Now)
Else
strtext = "*.0" & a & "." & Year(Now)
End If
Set c = .Range("AT2:AT" & .Rows.Count).Find(strtext, LookIn:=xlValues, lookat:=xlPart, _
SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:= _
False)
Information.ListBox5.AddItem Format(Month(Now) & " " & a, "MMMM") & " " & Year(Now)
If Not c Is Nothing Then
strFirst = c.Address
Do
Information.ListBox5.AddItem .Cells(c.Row, 43).Value
If InStr(.Cells(c.Row, 44).Value, ";") 0 Then
xstr = Split(.Cells(c.Row, 44).Value, ";")
Information.ListBox5.List(Information.ListBox5.ListCount - 1, 1) = xstr(0)
Else
Information.ListBox5.List(Information.ListBox5.ListCount - 1, 1) = .Cells(c.Row, 44). _
Value
End If
Information.ListBox5.List(Information.ListBox5.ListCount - 1, 2) = .Cells(c.Row, 45). _
Value
Information.ListBox5.List(Information.ListBox5.ListCount - 1, 3) = .Cells(c.Row, 46). _
Value
Information.ListBox5.List(Information.ListBox5.ListCount - 1, 4) = .Cells(c.Row, 1).Value
Information.ListBox5.List(Information.ListBox5.ListCount - 1, 5) = .Cells(c.Row, 47). _
Value
Information.ListBox5.List(Information.ListBox5.ListCount - 1, 6) = .Cells(c.Row, 2).Value
Set c = .Range("AT2:AT" & .Rows.Count).FindNext(c)
Loop While Not c Is Nothing And c.Address strFirst
End If
If ydnv - 1 >= 1 Then
With Workbooks("RWG_Daten.xlsx").Sheets("DNV")
Set cc = .Range("D2:D" & .Rows.Count).Find(strtext, LookIn:=xlValues, lookat:=xlPart, _
SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:= _
False)
If Not cc Is Nothing Then
strFirst = cc.Address
Do
Information.ListBox5.AddItem .Cells(cc.Row, 1).Value
Information.ListBox5.List(Information.ListBox5.ListCount - 1, 1) = .Cells(cc.Row, 2). _
Value
Information.ListBox5.List(Information.ListBox5.ListCount - 1, 2) = .Cells(cc.Row, 3). _
Value
Information.ListBox5.List(Information.ListBox5.ListCount - 1, 3) = .Cells(cc.Row, 4). _
Value
Information.ListBox5.List(Information.ListBox5.ListCount - 1, 4) = .Cells(cc.Row, 6). _
Value
Information.ListBox5.List(Information.ListBox5.ListCount - 1, 5) = .Cells(cc.Row, 5). _
Value
Information.ListBox5.List(Information.ListBox5.ListCount - 1, 6) = .Cells(cc.Row, 7). _
Value
Information.ListBox5.List(Information.ListBox5.ListCount - 1, 7) = .Cells(cc.Row, 8). _
Value
Set cc = .Range("D2:D" & .Rows.Count).FindNext(cc)
Loop While Not cc Is Nothing And cc.Address strFirst
End If
End With
End If
If c Is Nothing Then
Information.ListBox5.RemoveItem (Information.ListBox5.ListCount - 1)
lc = lc - 1
End If
Next
End With
Wie bekomme ich das nun in einem Array hin das ich auch weitere Informationen in die Listbox holen kann.
VG CMFA