Auflistung geht nicht mehr :(
17.07.2015 11:42:08
Max
Ich habe eine UF die beim Start in eine listBox alle Werte aus der Tabelle einliest:
Public Function ListeNormal()
Dim lZeile As Long
With UserForm1.ListBox1
.ColumnCount = 4
.ColumnWidths = "60Pt;60Pt;1000Pt;0Pt"
.Clear
lZeile = 3
Do While Trim(CStr(Tabelle2.Cells(lZeile, 1).Value)) ""
.AddItem Trim(CStr(Tabelle2.Cells(lZeile, 1).Value))
.List(.ListCount - 1, 1) = Trim(CStr(Tabelle2.Cells(lZeile, 6).Value))
.List(.ListCount - 1, 2) = Trim(CStr(Tabelle2.Cells(lZeile, 2).Value))
.List(.ListCount - 1, 3) = lZeile
lZeile = lZeile + 1
Loop
End With
With UserForm1.ListBox2
.ColumnCount = 4
.ColumnWidths = "60Pt;60Pt;1000Pt;0Pt"
.Clear
lZeile = 3
Do While Trim(CStr(Tabelle2.Cells(lZeile, 1).Value)) ""
.AddItem Trim(CStr(Tabelle2.Cells(lZeile, 1).Value))
.List(.ListCount - 1, 1) = Trim(CStr(Tabelle2.Cells(lZeile, 6).Value))
.List(.ListCount - 1, 2) = Trim(CStr(Tabelle2.Cells(lZeile, 2).Value))
.List(.ListCount - 1, 3) = lZeile
lZeile = lZeile + 1
Loop
End With
End Function
Funktioniert Super nur wenn ich jetzt eine CheckBox aktiviere die die Daten neu einliest aber anhand von kriterien und ich diese wieder deaktiviere sollte genau die selbe Funktion aufgerufen werden und alles einlesen. Geht auch bis auf die ersten 4 Zeilen (vlt auch mehr aber die erkennt man halt wenn sie fehlen). Zur kleinen Info bei den 4 steht in Spalte 6 nichts drinnen aber bei der Initialisierung gehts ja auch... Hier einfach mal der Aufruf Sub:Private Sub CheckBox2_Change ()
If CheckBox2 = False Then
ListeNormal
Function1 (1)
Function1 (2)
Function1 (3)
Function1 (4)
Function1 (5)
Function1 (6)
'Function1 (7)
'Function1 (8)
End If
End Sub
Zur ergänzung hier nich die Funktion Function:Public Function Function1(XY As Long)
Dim lZeile As Long
If UserForm1.ComboBox1 = Tabelle1.Cells(XY, 1).Value Then
With UserForm1.ListBox1
.ColumnCount = 4
.ColumnWidths = "60Pt;60Pt;1000Pt;0Pt"
.Clear
lZeile = 3
Do While Trim(CStr(Tabelle2.Cells(lZeile, 1).Value)) ""
If Tabelle2.Cells(lZeile, 7) = Tabelle1.Cells(XY, 1).Value Then
.AddItem Trim(CStr(Tabelle2.Cells(lZeile, 1).Value))
.List(.ListCount - 1, 1) = Trim(CStr(Tabelle2.Cells(lZeile, 6).Value))
.List(.ListCount - 1, 2) = Trim(CStr(Tabelle2.Cells(lZeile, 2).Value))
.List(.ListCount - 1, 3) = lZeile
End If
lZeile = lZeile + 1
Loop
End With
With UserForm1.ListBox2
.ColumnCount = 4
.ColumnWidths = "60Pt;60Pt;1000Pt;0Pt"
.Clear
lZeile = 3
Do While Trim(CStr(Tabelle2.Cells(lZeile, 1).Value)) ""
If Tabelle2.Cells(lZeile, 7) = Tabelle1.Cells(XY, 1).Value Then
.AddItem Trim(CStr(Tabelle2.Cells(lZeile, 1).Value))
.List(.ListCount - 1, 1) = Trim(CStr(Tabelle2.Cells(lZeile, 6).Value))
.List(.ListCount - 1, 2) = Trim(CStr(Tabelle2.Cells(lZeile, 2).Value))
.List(.ListCount - 1, 3) = lZeile
End If
lZeile = lZeile + 1
Loop
End With
End If
End Function
Hier wird noch geprüft ob in der ComboBox etwas drin steht aber bei allen tests war sie leer also sollte das nciht relevant seinVielen Dank schonmal im Vorraus ;)