Step Through Cells In Range

jstevens
GoldLounger
Posts: 2631
Joined: 26 Jan 2010, 16:31
Location: Southern California

Step Through Cells In Range

Post by jstevens »

Is it possible to read each cell in a RangeName from the bottom up. Similar to using Step -1?

Thanks,
John
Regards,
John

User avatar
StuartR
Administrator
Posts: 12633
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Step Through Cells In Range

Post by StuartR »

Assume you have a range called rngStuart
You can refer the cells in this range as
Range("rngStuart").Cells(n)
To access them all in reverse order you could use a construct like

Code: Select all

For n = Range("rngStuart").Cells.Count To 1 Step -1
     Debug.Print  Range("rngStuart").Cells(n).Value
Next n
StuartR


jstevens
GoldLounger
Posts: 2631
Joined: 26 Jan 2010, 16:31
Location: Southern California

Re: Step Through Cells In Range

Post by jstevens »

Stuart,

Thank you for your suggestion. I was able to incorporate it into my code.

Regards,
John
Regards,
John