Private
Sub
Search0_Click()
Dim
wb
As
Workbook
Dim
ws1
As
Worksheet
Dim
ws2
As
Worksheet
Dim
such
As
String
, LetzteZeile
As
Long
, i
As
Long
Dim
ctr
As
Control
Set
wb = ActiveWorkbook
Set
ws1 = wb.Worksheets(
"Übersicht"
)
Set
ws2 = wb.Worksheets(
"Datenbank"
)
such = UserForm1.TextBox1.Value
With
ws2
LetzteZeile = .Cells(.Rows.Count, 2).
End
(xlUp).Row
For
i = 5
To
LetzteZeile
If
.Cells(i, 2) = such
Then
MsgBox
"Wert gefunden"
For
Each
ctr
In
UserForm1.Controls
If
ctr.Name
Like
Nummer*
Then
UserForm1.Nummer* = .Cells(i, 1)
Exit
For
End
If
Exit
For
End
If
Next
i
End
With
End
Sub