Substring in excel? How about regular expressions?
You can break the loop with an EXIT FOR statement inside the IF construction.
Miguel.
"Samuel" wrote:
Thank you, that gets rid of that problem, but brings up a second one -
How do I break out of a loop?
If I have the following, I now get a compile error (next without for)
on the new "next' added within the new USA compare...How do I break
out?
For i = 1 To lastrow
str1 = ActiveSheet.Cells(r, c1)
If Left(str1, 3) = "USA" Then
...do something
Next
End If
...do something
Next
|