mit Hilfe von Euch Profis habe ich eine Userform erstellt, in der ich nach Artikeln suche und mir die Ergebnisse in einer Listbox angezeigt werden. Das funktioniert in soweit, wenn es sich ausschliesslich um Zahlen im Textfeld handelt.
Bei Alphanummerischen Artikelnummern wird mir gar nichts angezeigt, ob wohl es den Artikel im Sheet gibt.
Wie müsste der Code geändert werden, damit ich sowohl nur Zahlen wie auch Buchstaben abfragen kann?
Derzeitiger Code ist:
Private Sub TextBox_Artikel_AfterUpdate()
Dim boVorhanden As Boolean
Dim Zeile As Long
If IsNumeric(TextBox_Artikel.Text) Then
With ThisWorkbook.Worksheets("BESTAND")
For Zeile = 2 To .Cells(.Rows.Count, 6).End(xlUp).Row
If CLng(.Cells(Zeile, 2).Value) = CLng(TextBox_Artikel.Text) Then
boVorhanden = True
ListBox1.AddItem
ListBox1.List(ListBox1.ListCount - 1, 0) = .Cells(Zeile, 1).Value
ListBox1.List(ListBox1.ListCount - 1, 1) = .Cells(Zeile, 3).Value
ListBox1.List(ListBox1.ListCount - 1, 2) = .Cells(Zeile, 2).Value
ListBox1.List(ListBox1.ListCount - 1, 3) = .Cells(Zeile, 4).Value
ListBox1.List(ListBox1.ListCount - 1, 4) = .Cells(Zeile, 7).Value
ListBox1.List(ListBox1.ListCount - 1, 5) = .Cells(Zeile, 8).Value
ListBox1.List(ListBox1.ListCount - 1, 6) = .Cells(Zeile, 9).Value
End If
Next
End With
If Not boVorhanden Then
ListBox1.Clear
MsgBox "Die Artikel-Nummer ist nicht vorhanden!"
End If
End If
End Sub
Danke Andre