AW: Dateiliste mit Dateieigenschaften Category
09.10.2020 13:37:32
Thomas
ich habe es hinbekommen.
Private Sub ComboBox1_Change()
Application.EnableEvents = False
ListBox1.Clear
With Sheets("Search")
zeile = 5
Do
Zeichenkette = ""
If Me.ComboBox1 = .Cells(zeile, 5) Or Me.ComboBox1 = "" Then
For i = 1 To 9
Zeichenkette = Zeichenkette & .Cells(zeile, i) & "#"
Next i
If InStr(1, UCase(Zeichenkette), UCase(Me.TextBox1)) > 0 Then
ListBox1.AddItem .Cells(zeile, 9)
lngAnzahl = ListBox1.ListCount
ListBox1.List(lngAnzahl - 1, 1) = .Cells(zeile, 10)
ListBox1.List(lngAnzahl - 1, 2) = .Cells(zeile, 11)
ListBox1.List(lngAnzahl - 1, 3) = .Cells(zeile, 12)
ListBox1.List(lngAnzahl - 1, 4) = .Cells(zeile, 4)
ListBox1.List(lngAnzahl - 1, 5) = .Cells(zeile, 5)
ListBox1.List(lngAnzahl - 1, 6) = .Cells(zeile, 17)
ListBox1.List(lngAnzahl - 1, 7) = .Cells(zeile, 16)
ListBox1.List(lngAnzahl - 1, 8) = .Cells(zeile, 2)
ListBox1.List(lngAnzahl - 1, 9) = zeile
End If
End If
zeile = zeile + 1
Loop Until IsEmpty(.Cells(zeile, 2))
End With
Application.EnableEvents = True
End Sub
Private Sub CommandButton2_Click()
Application.EnableEvents = False
'Speichern in Listbox
ListBox1.List(ListBox1.ListIndex, 1) = TextBox2
ListBox1.List(ListBox1.ListIndex, 1) = TextBox3
ListBox1.List(ListBox1.ListIndex, 2) = TextBox4
ListBox1.List(ListBox1.ListIndex, 3) = TextBox5
'Speichern in Tabell
With Sheets("Search")
zeile = ListBox1.List(ListBox1.ListIndex, 9)
.Cells(zeile, 1) = Me.TextBox2
.Cells(zeile, 2) = Me.TextBox3
.Cells(zeile, 3) = Me.TextBox4
.Cells(zeile, 4) = Me.TextBox5
End With
Application.EnableEvents = True
End Sub
Private Sub ListBox1_Click() 'Übergabe in Textboxen
TextBox2 = ListBox1.List(ListBox1.ListIndex, 0)
TextBox3 = ListBox1.List(ListBox1.ListIndex, 1)
TextBox4 = ListBox1.List(ListBox1.ListIndex, 2)
TextBox5 = ListBox1.List(ListBox1.ListIndex, 3)
End Sub
Private Sub TextBox1_Change()
Application.EnableEvents = False
ListBox1.Clear
With Sheets("Search")
zeile = 5
Do
Zeichenkette = ""
If Me.ComboBox1 = .Cells(zeile, 5) Or Me.ComboBox1 = "" Then
For i = 1 To 9
Zeichenkette = Zeichenkette & .Cells(zeile, i) & "#"
Next i
If InStr(1, UCase(Zeichenkette), UCase(Me.TextBox1)) > 0 Then
ListBox1.AddItem .Cells(zeile, 9)
lngAnzahl = ListBox1.ListCount
ListBox1.List(lngAnzahl - 1, 1) = .Cells(zeile, 10)
ListBox1.List(lngAnzahl - 1, 2) = .Cells(zeile, 11)
ListBox1.List(lngAnzahl - 1, 3) = .Cells(zeile, 12)
ListBox1.List(lngAnzahl - 1, 4) = .Cells(zeile, 4)
ListBox1.List(lngAnzahl - 1, 5) = .Cells(zeile, 5)
ListBox1.List(lngAnzahl - 1, 6) = .Cells(zeile, 17)
ListBox1.List(lngAnzahl - 1, 7) = .Cells(zeile, 16)
ListBox1.List(lngAnzahl - 1, 8) = .Cells(zeile, 2)
ListBox1.List(lngAnzahl - 1, 9) = zeile
End If
End If
zeile = zeile + 1
Loop Until IsEmpty(.Cells(zeile, 2))
End With
Application.EnableEvents = True
End Sub
Private Sub UserForm_Initialize()
With Me.ListBox1
.ColumnCount = 10
.ColumnWidths = "50;60;150;250;60;50;40;40;50;50"
.Font.Size = 8
' .BackColor = Sheets("Search").Range("A1").Interior.Color
' .MultiSelect = fmMultiSelectSingle 'fmMultiSelectMulti
End With
With Sheets("Search")
zeile = 5
Do
ListBox1.AddItem .Cells(zeile, 9)
lngAnzahl = ListBox1.ListCount
ListBox1.List(lngAnzahl - 1, 1) = .Cells(zeile, 10)
ListBox1.List(lngAnzahl - 1, 2) = .Cells(zeile, 11)
ListBox1.List(lngAnzahl - 1, 3) = .Cells(zeile, 12)
ListBox1.List(lngAnzahl - 1, 4) = .Cells(zeile, 4)
ListBox1.List(lngAnzahl - 1, 5) = .Cells(zeile, 5)
ListBox1.List(lngAnzahl - 1, 6) = .Cells(zeile, 17)
ListBox1.List(lngAnzahl - 1, 7) = .Cells(zeile, 16)
ListBox1.List(lngAnzahl - 1, 8) = .Cells(zeile, 2)
ListBox1.List(lngAnzahl - 1, 9) = zeile
zeile = zeile + 1
Loop Until IsEmpty(.Cells(zeile, 2))
End With
Me.ComboBox1.AddItem "AUFTRAG"
Me.ComboBox1.AddItem "OHNE ABNR"
End Sub
Selektion funktioniert schon mal nach der ComboBox