ich versuche gerade mich an einer Listbox für meine Userform und bräuchte kurz mal Hilfe.
In Listbox2 mache ich die Überschriften.
In Listbox1 sollen die Daten rein.
Die Listbox 1 Filtere ich vorher noch. Dazu habe ich unter anderem eine Liste "AZGListe" im Namensmanager erstellt, die ich für den Filter verwenden möchte. Leider funktioniert das mit den Namen leider nicht.
Wie müsste ich die Abfrage ändern, damit er nur die Namen aus der AZGListe anzeigt?
Private Sub UserForm_Initialize()
ListBox2.AddItem Sheets("Themenliste").Cells(1, 1).Value
ListBox2.List(ListBox2.ListCount - 1, 1) = Sheets("Themenliste").Cells(1, 2).Value
ListBox2.List(ListBox2.ListCount - 1, 2) = Sheets("Themenliste").Cells(1, 3).Value
ListBox2.List(ListBox2.ListCount - 1, 3) = Sheets("Themenliste").Cells(1, 4).Value
ListBox2.List(ListBox2.ListCount - 1, 4) = Sheets("Themenliste").Cells(1, 5).Value
ListBox2.List(ListBox2.ListCount - 1, 5) = Sheets("Themenliste").Cells(1, 6).Value
ListBox2.List(ListBox2.ListCount - 1, 6) = Sheets("Themenliste").Cells(1, 7).Value
ListBox2.List(ListBox2.ListCount - 1, 7) = Sheets("Themenliste").Cells(1, 8).Value
ListBox2.List(ListBox2.ListCount - 1, 8) = Sheets("Themenliste").Cells(1, 9).Value
ListBox2.List(ListBox2.ListCount - 1, 9) = Sheets("Themenliste").Cells(1, 10).Value
'Themenspeicher einlesen
ListBox1.Clear
With Sheets("Themenliste")
For intCounter = 2 To .Cells(Rows.Count, 1).End(xlUp).Row
If .Cells(intCounter, 1) "" And Rows(intCounter).RowHeight > 0 And .Cells(intCounter, 1) = _
AZGListe Then
ListBox1.AddItem .Cells(intCounter, 1).Value
ListBox1.List(ListBox1.ListCount - 1, 1) = .Cells(intCounter, 2).Value
ListBox1.List(ListBox1.ListCount - 1, 2) = .Cells(intCounter, 3).Value
ListBox1.List(ListBox1.ListCount - 1, 3) = .Cells(intCounter, 4).Value
ListBox1.List(ListBox1.ListCount - 1, 4) = .Cells(intCounter, 5).Value
ListBox1.List(ListBox1.ListCount - 1, 5) = .Cells(intCounter, 6).Value
ListBox1.List(ListBox1.ListCount - 1, 6) = .Cells(intCounter, 7).Value
ListBox1.List(ListBox1.ListCount - 1, 7) = .Cells(intCounter, 8).Value
ListBox1.List(ListBox1.ListCount - 1, 8) = .Cells(intCounter, 9).Value
ListBox1.List(ListBox1.ListCount - 1, 9) = .Cells(intCounter, 10).Value
End If
Next intCounter
End With
End Sub
Liebe GrüsseStefan