View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Kilmer Bob Kilmer is offline
external usenet poster
 
Posts: 280
Default Using VB to find next cell in range

You can treat the range as a vertical array of Cells and access them by
index:.

With Range("A3:A350")
Debug.Print .Cells(1).Value 'cell A3
Debug.Print .Cells(2).Value 'cell A4
Debug.Print .Cells(3).Value 'cell A5
...
Debug.Print .Cells(.Cells.Count).Value 'cellA350
End With

Range("A3:A350").Cells.Count gives the total number of cells in the range.

You could access the entire series in a counter controlled loop.

Bob Kilmer


"Tim" wrote in message
...
Can someone help me find the code that will allow me to
find the next cell in a range. I have a range set up,
i.e. Range("A3:A350"), and a range variable set to the
first cell A3. As my code executes I need the range
variable originally set to A3 to move down the larger
range of ("A3:A350"), say to A4. I thought the Next
property might work but I am having trouble with it. Any
help would be appreciated!!

Tim McPhillips