Private
Sub
Nachname_suchen_Click()
Dim
rngCell
As
Range
Dim
strFirstAddress
As
String
With
Worksheets(
"Stammdaten"
).Range(
"B:B"
)
Me
.ListBox1.Clear
Set
rngCell = .Find(
Me
.TextBox1.Value, LookIn:=xlValues, lookat:=xlWhole)
If
Not
rngCell
Is
Nothing
Then
strFirstAddress = rngCell.Address
Do
With
Me
.ListBox1
.ColumnCount = 19
.AddItem
.List(.ListCount - 1, 0) = rngCell.Offset(0, -1).Value
.List(.ListCount - 1, 1) = rngCell.Offset(0, 0).Value
.List(.ListCount - 1, 2) = rngCell.Offset(0, 1).Value
.ColumnWidths =
"3,0cm;3,0cm;3,0cm;3,0cm"
End
With
Set
rngCell = .FindNext(rngCell)
Loop
While
Not
rngCell
Is
Nothing
And
rngCell.Address <> strFirstAddress
Else
MsgBox
"Nachname nicht gefunden"
, 48
End
If
End
With
End
Sub