I am trying to find the multiple row numbers in which a particular value is found inside.
In the code shown below, the red coloured line shows an error
Code
Sub LoopThroughSheets(i)
Dim findRng As Range
' Dim firstRow As Long
' Dim row As Long
Dim allFinds As String
Dim numberOfRowsWithSameMKB As Integer
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_array(j), lookat:=xlPart)
If Not findRng Is Nothing Then
firstRow = findRng.row
Call SearchForPKZ(firstRow, i)
Do
Set findRng = .UsedRange.FindNext(findRng)
nextrow = findRng.row
If Not findRng Is Nothing Then Call SearchForPKZ(findRng.row, i)
Loop While Not findRng Is Nothing And nextrow <> firstRow
End If
End With
Next ws
Next j
End Sub
Display More
and if i remove ' And findRng.row <> firstRow ' , it works but loops infinitely which is not what i wanted .So it means only this portion has an issue.
Can anyone help me please !!