in meinem Projekt, dass ich mit Hilfe dieses Forums erstellt habe, wird in ein Textfeld eine Zahl eingescannt und die dazugehörigen Daten aus zwei Tabellenblättern gesucht und danach in einer Listbox angezeigt.
Im ersten Tabellenblatt stehen ca. 60 Zeilen und im zweiten bis zu 600 Zeilen.
Die zweit Suche verzögert den Prozess mittlerweile sehr und daher meine Frage, ob es eine schnellere Variante gibt.
Bin leider nicht so bewandert, dass ich das selbst hin bekomme.
Wäre daher über Vorschläge und Code-Anpassungen dankbar.
Hier mein Code:
Private Sub TextBox_Scan_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim c As Range
Dim rngBereich As Range
Dim lngAnzahl As Long
Dim strFirst As String
With Sheets("WE")
Set rngBereich = .Columns("L:L")
Set c = rngBereich.Find(TextBox_Scan, LookIn:=xlValues, LookAt:=xlPart)
If Not c Is Nothing Then
If Not c = "" Then
strFirst = c.Address
Do
ListBox1.AddItem .Cells(c.Row, 12)
lngAnzahl = ListBox1.ListCount
ListBox1.List(lngAnzahl - 1, 1) = .Cells(c.Row, 2)
ListBox1.List(lngAnzahl - 1, 2) = .Cells(c.Row, 3)
ListBox1.List(lngAnzahl - 1, 3) = .Cells(c.Row, 4)
ListBox1.List(lngAnzahl - 1, 4) = .Cells(c.Row, 13)
Set c = rngBereich.FindNext(c)
Loop While Not c Is Nothing And c.Address strFirst
End If
Else
MsgBox "Palette nicht gefunden!", 48
End If
End With
With ListBox1
For i = 0 To .ListCount - 1
Set rngBereich = Sheets("Pal-Faktor").Columns("A:A").Find(.List(i, 1), _
LookIn:=xlValues, LookAt:=xlWhole)
If Not rngBereich Is Nothing Then
.List(i, 5) = rngBereich.Offset(, 1)
Else
End If
Next i
End With
With TextBox_Scan
.Value = ""
End With
If Raus = 0 Then
Cancel = True
Raus = 1
End If
Set c = Nothing: Set rngBereich = Nothing
End Sub