View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 671
Default Range created using Union...accessing cells

In trying to use the ranges created from Union, I can't refer to the cells
properly.

For example, R1=Union(myrange1, myrange2)

If I try the following it works fine:

Dim c as range
For each c in R1.Cells
msgbox c.Address
Next

If I try the following the second iteration when I=2 gives me the address of
the row in the worksheet right below R1.Cells(1,1). It doesn't give me the
address of the second row, fist column cell of R1:

Dim I As long
For I = 1 to R1.Cells.Count
msgbox R1.Cells(I, 1).Address
Next I