I am using FindNext function to get the row information of cell containing a variable called 'MKB' .
my code is given below :
Sub LoopThroughSheets(MKB As Variant)
Dim findRng As Range
Dim firstRow As Long
Dim allFinds As String
Workbooks(SYSDatei).Activate
For j = 0 To SizeOfMKB_array - 1
For Each ws In Workbooks(SYSDatei).Worksheets
wsName = ws.Name
With Workbooks(SYSDatei).Worksheets(wsName)
Set findRng = .UsedRange.Find(MKB, lookat:=xlPart)
If Not findRng Is Nothing Then
firstRow = findRng.row
Do
MsgBox (firstRow)
Set findRng = .FindNext(findRng)
Loop While Not findRng Is Nothing And findRng.row <> firstRow
End If
End With
Next ws
Next j
End Sub
but vba editor shows an error message on the code line - 'Set findRng = .FindNext(findRng) ' saying "object does not support this property or method"..Please help !!!
my code is given below :
Sub LoopThroughSheets(MKB As Variant)
Dim findRng As Range
Dim firstRow As Long
Dim allFinds As String
Workbooks(SYSDatei).Activate
For j = 0 To SizeOfMKB_array - 1
For Each ws In Workbooks(SYSDatei).Worksheets
wsName = ws.Name
With Workbooks(SYSDatei).Worksheets(wsName)
Set findRng = .UsedRange.Find(MKB, lookat:=xlPart)
If Not findRng Is Nothing Then
firstRow = findRng.row
Do
MsgBox (firstRow)
Set findRng = .FindNext(findRng)
Loop While Not findRng Is Nothing And findRng.row <> firstRow
End If
End With
Next ws
Next j
End Sub
but vba editor shows an error message on the code line - 'Set findRng = .FindNext(findRng) ' saying "object does not support this property or method"..Please help !!!