Go straight to next value in a For... Next loop
check out this structu
Sub demo()
For Each c In Selection
If c.Value < 100 Then
Else
msbgox ("time to do something")
End If
Next
End Sub
if the value is less than 100 we do absolutely nothing exept move on to the
next c
--
Gary''s Student
gsnu200707
"IanKR" wrote:
Is there a way of going straight to the next value in a For / Next loop,
having tested the current value? I need to do something like this (for
example):
Dim c as Range
For each c in Selection.Cells
If c.Value < 100 Then
Goto Next c '<<<<< I know this is illegal, but it illustrates
what I want to do!
Else
{statements where c.Value = 100}
...
...
End If
Next c
I don't want to Exit For, I just want it to effectively ignore the current
instance of c and move onto the next. I've tried "Next c" but it generates a
compile error.
Thanks in advance.
Ian
|