Hi - although I don't follow exactly what you're trying to do, to exit a loop on a condition met within the loop I use a GoTo like:
Hope that helps. MM![]()
Sub aa() r = ActiveSheet.UsedRange.Rows.Count For i = 1 To r - 1 If InStr(3, Cells(i, 3).Value, "MOUNT") > 0 Then z = i + 1 For z = 1 To r - 1 If Cells(z, "a").Value <> "" Then Rows(z).Select Selection.Delete Shift:=xlUp ElseIf Cells(z, "a").Value = "" Then GoTo ExitLoop End If Next z ExitLoop: End If Next i End Sub
Bookmarks