NessPJ
Active Member
- Joined
- May 10, 2011
- Messages
- 431
- Office Version
- 365
Hi,
My search keeps looping. I found some other threads/tips to try and counter that by checking the first found address against the next one, but it does not seem to work.
Can anyone tell me what i am doing wrong please?
My search keeps looping. I found some other threads/tips to try and counter that by checking the first found address against the next one, but it does not seem to work.
Can anyone tell me what i am doing wrong please?
VBA Code:
Dim Found As Range
Dim FoundRegel As Long
Dim FirstFoundAddr As String
Dim ActiveFoundCell As Range
Set SearchRange = Range("A:AZ")
With SearchRange
Set Found = Cells.Find(What:="AAA", LookIn:=xlFormulas, LookAt:=xlPart)
If Not Found Is Nothing Then
FirstFoundAddr = Found.Address
FoundRegel = Found.Row
End If
Do Until Found Is Nothing
If PlanWb.Sheets(CurSheet).Range("P" & FoundRegel).Value = 1 Then
PlanWb.Sheets(CurSheet).Range("R" & FoundRegel).Value = 10
PlanWb.Sheets(CurSheet).Range("S" & FoundRegel).Value = "Checked"
PlanWb.Sheets(CurSheet).Range("Z" & FoundRegel).Value = "0:15"
End If
Set ActiveFoundCell = .FindNext(After:=Found)
If ActiveFoundCell.Address = FirstFoundAddr Then Exit Do
Loop
End With