Live-Forum - Die aktuellen Beiträge
Datum
Titel
29.03.2024 13:14:12
28.03.2024 21:12:36
28.03.2024 18:31:49
Anzeige
Archiv - Navigation
1596to1600
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

Kombinierte Suche

Kombinierte Suche
01.01.2018 14:49:43
adcak
Hallo zusammen,
ich möchte mit mehreren Textboxen suchen/filtern. Habe einiges ausprobiert, aber habe es trotzdem nicht gebacken bekommen.
Jede Textbox gehört zur einer Spalte, und mit einer Textbox kann ich problemlos suchen aber möchte mit der 2. Textbox genauer filtern.
Ich vermute aber das ich nah dran bin, und nur eine Zeile fehlt.Bzw ein Code die Textboxen zu verbinden/synchronisieren.
Meine Textboxen sehen wie folgt aus.
Private Sub TextBox1_Change()
With Wareneingang.ListBox1
Dim i As Long
Dim j As Long
Dim a As Long
ListBox1.Clear
a = Len(TextBox1)
For i = 1 To ZZFFF3.UsedRange.Rows.Count
If ZZFFF3.Cells(i, 9) = "" Then
For j = 1 To Len(ZZFFF3.Cells(i, 2)) - a + 1
If UCase(Mid(ZZFFF3.Cells(i, 2), j, a)) = UCase(TextBox1) Then
.AddItem (ZZFFF3.Cells(i, 1))   'Spalte A kommt in Column 0
.List(.ListCount - 1, 1) = (ZZFFF3.Cells(i, 2)) 'Spalte B-J
.List(.ListCount - 1, 2) = (ZZFFF3.Cells(i, 3))
.List(.ListCount - 1, 3) = (ZZFFF3.Cells(i, 4))
.List(.ListCount - 1, 4) = (ZZFFF3.Cells(i, 5))
.List(.ListCount - 1, 5) = (ZZFFF3.Cells(i, 6))
.List(.ListCount - 1, 7) = (ZZFFF3.Cells(i, 8))
.List(.ListCount - 1, 8) = (ZZFFF3.Cells(i, 9))
.List(.ListCount - 1, 9) = (ZZFFF3.Cells(i, 10))
Exit For
End If
Next j
End If
Next i
End With
End Sub
Private Sub TextBox2_Change()
With Wareneingang.ListBox1
Dim i As Long
Dim j As Long
Dim a As Long
ListBox1.Clear
a = Len(TextBox2)
For i = 1 To ZZFFF3.UsedRange.Rows.Count
If ZZFFF3.Cells(i, 9) = "" Then
For j = 1 To Len(ZZFFF3.Cells(i, 3)) - a + 1
If UCase(Mid(ZZFFF3.Cells(i, 3), j, a)) = UCase(TextBox2) Then
.AddItem (ZZFFF3.Cells(i, 1))   'Spalte A kommt in Column 0
.List(.ListCount - 1, 1) = (ZZFFF3.Cells(i, 2)) 'Spalte B-J
.List(.ListCount - 1, 2) = (ZZFFF3.Cells(i, 3))
.List(.ListCount - 1, 3) = (ZZFFF3.Cells(i, 4))
.List(.ListCount - 1, 4) = (ZZFFF3.Cells(i, 5))
.List(.ListCount - 1, 5) = (ZZFFF3.Cells(i, 6))
.List(.ListCount - 1, 7) = (ZZFFF3.Cells(i, 8))
.List(.ListCount - 1, 8) = (ZZFFF3.Cells(i, 9))
.List(.ListCount - 1, 9) = (ZZFFF3.Cells(i, 10))
Exit For
End If
Next j
End If
Next i
End With
End Sub

Private Sub TextBox3_Change()
With Wareneingang.ListBox1
Dim i As Long
Dim j As Long
Dim a As Long
a = Len(TextBox3)
ListBox1.Clear
For i = 1 To ZZFFF3.UsedRange.Rows.Count
If ZZFFF3.Cells(i, 9) = "" Then
For j = 1 To Len(ZZFFF3.Cells(i, 6)) - a + 1
If UCase(Mid(ZZFFF3.Cells(i, 6), j, a)) = UCase(TextBox3) Then
.AddItem (ZZFFF3.Cells(i, 1))   'Spalte A kommt in Column 0
.List(.ListCount - 1, 1) = (ZZFFF3.Cells(i, 2)) 'Spalte B-J
.List(.ListCount - 1, 2) = (ZZFFF3.Cells(i, 3))
.List(.ListCount - 1, 3) = (ZZFFF3.Cells(i, 4))
.List(.ListCount - 1, 4) = (ZZFFF3.Cells(i, 5))
.List(.ListCount - 1, 5) = (ZZFFF3.Cells(i, 6))
.List(.ListCount - 1, 7) = (ZZFFF3.Cells(i, 8))
.List(.ListCount - 1, 8) = (ZZFFF3.Cells(i, 9))
.List(.ListCount - 1, 9) = (ZZFFF3.Cells(i, 10))
Exit For
End If
Next j
End If
Next i
End With
End Sub

Private Sub TextBox4_Change()
With Wareneingang.ListBox1
Dim i As Long
Dim j As Long
Dim a As Long
a = Len(TextBox4)
ListBox1.Clear
For i = 1 To ZZFFF3.UsedRange.Rows.Count
If ZZFFF3.Cells(i, 9) = "" Then
For j = 1 To Len(ZZFFF3.Cells(i, 8)) - a + 1
If UCase(Mid(ZZFFF3.Cells(i, 8), j, a)) = UCase(TextBox4) Then
.AddItem (ZZFFF3.Cells(i, 1))   'Spalte A kommt in Column 0
.List(.ListCount - 1, 1) = (ZZFFF3.Cells(i, 2)) 'Spalte B-J
.List(.ListCount - 1, 2) = (ZZFFF3.Cells(i, 3))
.List(.ListCount - 1, 3) = (ZZFFF3.Cells(i, 4))
.List(.ListCount - 1, 4) = (ZZFFF3.Cells(i, 5))
.List(.ListCount - 1, 5) = (ZZFFF3.Cells(i, 6))
.List(.ListCount - 1, 7) = (ZZFFF3.Cells(i, 8))
.List(.ListCount - 1, 8) = (ZZFFF3.Cells(i, 9))
.List(.ListCount - 1, 9) = (ZZFFF3.Cells(i, 10))
Exit For
End If
Next j
End If
Next i
End With
End Sub

3
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
Crossposting
03.01.2018 16:53:37
Hajo_Zi
muss nicht offen sein.
Gruß Hajo

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige