Hallo Leute
Ich versuche ein Tool zur suche von Sachen in einer Liste zu konstruieren. Dennoch gelingt es mir nicht so wie ich es möchte, mein problem ist das mein 2D array in der ListBox1 nicht angezeigt wird. Das ist der Code:
Private arrIN() As Variant
Private shCount As Long
Private Sub UserForm_Initialize()
Dim Current As Worksheet
Dim i As Integer
Dim a As Integer
Dim k As Long
Dim s As String
For Each Current In Worksheets
If Current.CodeName <> "Tabelle1" And Current.Name <> "Datenbank einlesen" And Sheets(Current.Name).Visible = True Then
shCount = i
i = i + 1
End If
Next
If i = 0 Then
MsgBox "Es ist keine Datenbank vorhanden!" & Chr(13) & "Bitte importieren sie eine Datenbank ", vbInformation, "Hinweiß!"
Unload UserForm1
Exit Sub
End If
ReDim arrIN(shCount)
For Each Current In Worksheets
If Current.CodeName <> "Tabelle4" And Sheets(Current.Name).Visible = True Then
arrIN(a) = Sheets(Current.Name).Range("D2:D" & Sheets(Current.Name).Cells(Rows.Count, 1).End(xlUp).Row)
a = a + 1
End If
Next
'For Each Current In Worksheets
' If Current.CodeName <> "Tabelle1" And Current.Name <> "Datenbank einlesen" And Sheets(Current.Name).Visible = True Then
' ReDim arrIN(shCount, Sheets(Current.Name).Cells(Rows.Count, 1).End(xlUp).Row, 4)
' arrIN = Sheets(Current.Name).Range("B2:E" & Sheets(Current.Name).Cells(Rows.Count, 1).End(xlUp).Row)
' End If
'Next
ListBox1.List = arrIN(10) 'Array(arrIN(0), arrIN(1), arrIN(2), arrIN(3), arrIN(4), arrIN(5), arrIN(6), arrIN(7), arrIN(8), arrIN(9), arrIN(10))
End Sub
Vielen Dank schon mal im vorraus
Herbert
|