Private
Sub
CommandButton1_Click()
Dim
rngCell
As
Range
Dim
strFirstAddress
As
String
With
Worksheets(
"Stammdaten"
).Range(
"A:A"
)
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 = 4
.AddItem
.List(.ListCount - 1, 0) = rngCell.Value
.List(.ListCount - 1, 1) = rngCell.Offset(0, 1).Value
.List(.ListCount - 1, 2) = rngCell.Offset(0, 2).Value
.List(.ListCount - 1, 3) = rngCell.Offset(0, 3).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
"Abteilung nicht gefunden"
, 48
End
If
End
With
End
Sub