Thread: For..Next..Loop
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
default105 default105 is offline
external usenet poster
 
Posts: 17
Default For..Next..Loop

Excel 2k

How does excel vba handle for next loop value from a range? When it looks
at the range V3:V34, does it start at V3 then V4 then V5 etc... The
Example below is a snippet of the code I have and I would like to shorten the
runtime to be the most efficient. If it does start at the top of the range
then I assume that the isempty() function will always work. If not would you
please explain the best way to do this. This is used on the worksheet change
event to locate days on a schedule and mark the appropriate cell. This sheet
changes by the year entered, that is why I have to evaluate the range. I
hope this is enough information to answer this question. Much "thanks" in
advance.
Dim cell, vcell As Range
For Each cell In Sheet16.Range("A1:BC231")
For Each vcell In Sheet4.Range("V3:V34")
If IsEmpty(vcell) = True Then
Exit For
End If
If cell.Value = vcell.Value Then


Sheets(cell.Parent.Name).Range(cell.Offset(1, 0).Address(False, False)) = "V"
Exit For
End If
Next vcell
Next vcell
--
Pete Blackburn - words to live by:
"Don''t ever let somebody tell you. You can''t do something.You got a
dream,You gotta protect it." Edited Quote from the Pursuit Of Happiness