AW: userform suchoption ?
Beni
Hallo hawk,
mit diesem Code suchst Du nach den Inhalten der gefüllten TextBoxen und die übereinstimmungen werden in ListBox1 gefüllt, beim Klick in ListBox1, wird die Zeile in die TextBoxen übertragen.
Du musst gleichviele TextBoxen wie Spalten haben, mit den Namen "TextBox & Spalten-Nr" und eine ListBox mit dem Namen "ListBox1"
Gruss Beni
Private Sub CommandButton1_Click()
ListBox1.Clear
ListBox1.ColumnCount = Sheets("Tabelle1").Cells(1, 256).End(xlToLeft).Column
z = 0
ListBox1.ColumnCount = Sheets("Tabelle1").Cells(1, 256).End(xlToLeft).Column
For R = 2 To Sheets("Tabelle1").Cells(65536, 1).End(xlUp).Row
n = 0
With Sheets("Tabelle1")
For intIndex = 1 To Sheets("Tabelle1").Cells(1, 256).End(xlToLeft).Column
If Controls("TextBox" & CStr(intIndex)) <> "" Then
If .Cells(R, intIndex) & "*" <> Controls("TextBox" & CStr(intIndex)) & "*" Then
n = 1
Exit For
End If
End If
Next intIndex
If n = 0 Then
ListBox1.AddItem .Cells(R, 1)
For c = 2 To Sheets("Tabelle1").Cells(1, 256).End(xlToLeft).Column
ListBox1.List(z, c - 1) = .Cells(R, c)
Next c
z = z + 1
End If
End With
Next R
End Sub
Private Sub ListBox1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
ListBox1.SetFocus
For i = 1 To ListBox1.ColumnCount
ListBox1.BoundColumn = i
Controls("TextBox" & CStr(i)).Value = ListBox1.Value
Next i
End Sub