Option
Explicit
Sub
Test()
Dim
rngLotId
As
Excel.Range
Dim
rngConfirmId
As
Excel.Range
Dim
strWhat
As
String
strWhat = Trim$(InputBox(
"Bitte geben Sie eine Losnummer ein:"
))
If
Len(strWhat) = 0 _
Then
Exit
Sub
With
Worksheets(
"Vorgabedatei"
).Range(
"A1:A100"
)
Set
rngLotId = .Find( _
What:=strWhat, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByColumns, _
MatchCase:=
False
)
If
Not
rngLotId
Is
Nothing
Then
Dim
strFirstAddr
As
String
strFirstAddr = rngLotId.Address
Do
Set
rngConfirmId = rngLotId.Worksheet.Cells(rngLotId.Row,
"C"
)
Debug.Print
"LotId: '"
; rngLotId.Value;
"', ConfirmId: '"
; rngConfirmId.Value;
"' (Row: "
;
CStr
(rngLotId.Row);
")"
Set
rngLotId = .FindNext(After:=rngLotId)
Loop
While
rngLotId.Address <> strFirstAddr
End
If
End
With
End
Sub