View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Matthew Wieder Matthew Wieder is offline
external usenet poster
 
Posts: 48
Default NonContiguous Range Iteration Bug?

observed in Office 2003

Matthew Wieder wrote:

If I have a noncontiguous range oRange defined as "V31:W31,Y31:Z31" and
I iterate through the cells with "For Each cell In oRange.Cells" set the
cell value to 5, everything works fine. However, if I iterate through
with:
For i = 1 To 4
oRange.Cells(i).Value = 5
next i

The values go into "V31:W32"!
Why should using the index not work the same as a "for each" statement?
How do I reference the 3rd cell in the noncontiguous range without
iterating through the first 2?
I assume this is a bug...