AW: Kleine Frage noch, bitte
24.02.2013 22:59:14
fcs
Hallo Kurt,
das wurde jetzt etwas komplizierter als gedacht.
Gruß
Franz
Hier die Teile im Userformcode, in denen du Anpassungen machen musst:
Option Explicit
Private varData() 'Array für Daten aus Tabelle Lager
Private bolDoubleklick As Boolean '##neu
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
bolDoubleklick = True '##neu
With Me.ListBox1
If .ListIndex -1 Then
Me.TextBox1 = .List(.ListIndex, 0)
Me.TextBox1.Tag = Format(.List(.ListIndex, 4), "0") 'Zeilenummer
Me.TextBox2 = .List(.ListIndex, 1)
Me.TextBox3 = .List(.ListIndex, 2)
Me.TextBox4 = .List(.ListIndex, 3)
End If
End With
bolDoubleklick = False '##neu
End Sub
Private Sub TextBox1_Change()
If bolDoubleklick = True Then Exit Sub
Dim lZeile As Long, lSpalte As Long
Dim iLiBo As Integer
Dim sSuchbegriff As String
Dim arrTemp()
With Me.TextBox1
If Len(.Value) = 1 Then
sSuchbegriff = UCase(.Value) '##geändert
.Tag = ""
Me.TextBox2 = ""
Me.TextBox3 = ""
Me.TextBox4 = ""
ListBox1.Clear
For lZeile = LBound(varData, 1) To UBound(varData, 1)
If UCase(Left(varData(lZeile, 1), Len(sSuchbegriff))) = sSuchbegriff Then '##geändert
iLiBo = iLiBo + 1
ReDim Preserve arrTemp(1 To 5, 1 To iLiBo)
For lSpalte = 1 To 5
arrTemp(lSpalte, iLiBo) = varData(lZeile, lSpalte)
Next
End If
Next lZeile
If iLiBo = 0 Then
If Me.ckbMeldung = True Then
MsgBox "Zum Suchbegriff """ & sSuchbegriff & """ wurde kein Eintrag gefunden.", _
vbInformation + vbOKOnly, " Hinweis für " & Application.UserName
End If
Else
Call Fill_Listbox(strBoxName:="Listbox1", Daten:=arrTemp, bolTranspose:=True)
Erase arrTemp
End If
End If
End With
End Sub