But in re-looking at the OP's code, I'm not sure why Chip offered this
advice (which, on its own face, is excellent advice) as it just doesn't seem
to be applicable to the OP's message.
--
Rick (MVP - Excel)
"Rick Rothstein" wrote in message
...
Chip meant to say in his last line...
You should **not** touch the index variable.
--
Rick (MVP - Excel)
"Chip Pearson" wrote in message
...
Personally, I think it is a very bad programming practice to do
anything at all with the index variable of a For loop. It leads to
messy and complicated code that is difficult to debug, maintain, and
enhance. You should touch the index variable.
Cordially,
Chip Pearson
Microsoft MVP 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
[email on web site]
On Sat, 19 Dec 2009 16:39:25 +0100, "Jan Kronsell"
wrote:
I have something like
For Each cel in Sheets("Mate").Range(A1:A10000).Cells
If IsEmpty(cel.Value) then Next cel
If ......
.....
End If
Next cel
This fails with a "Next without For" message.
To make it work I have changed the code to
For Each cel in Sheets("Mate").Range(A1:A10000).Cells
If IsEmpty(cel.Value) then GoTo MyLabel
If ......
.....
End If
MyLabel:
Next cel
But I wonder if it can be done, without the GoTo statement?
Jan