Private
Sub
suchBoxBttn_Click()
Dim
zeLL
Dim
strSN
As
String
Dim
strN
As
String
Dim
rngXX
As
Range
Dim
intEnd
Dim
blnFound
As
Boolean
strSN =
CStr
(
Me
.TextBox1)
strN =
CStr
(
Me
.TextBox2)
Set
rngXX = Tabelle1.Range(
"A2:A100"
)
For
Each
zeLL
In
rngXX.Cells
If
CStr
(zeLL.Value) = strSN
Then
zeLL.Interior.ColorIndex = 6
blnFound =
True
Else
zeLL.Interior.ColorIndex = xlColorIndexNone
blnFound =
False
End
If
Next
zeLL
If
blnFound =
True
Then
MsgBox
"Serienummer bereits vorhanden"
Else
intEnd = Cells(Rows.Count, 1).
End
(xlUp).Row + 1
Cells(intEnd, 1).Value = strSN
Cells(intEnd, 2).Value = strN
End
If
Worksheets(
"Tabelle1"
).Activate
Unload
Me
SuchenBox.Hide
End
Sub