View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Steve Drenker[_5_] Steve Drenker[_5_] is offline
external usenet poster
 
Posts: 2
Default Working with one Column in a Named Range

This must be simple...

I want to iterate across all cells in the second column of a named range
("Data_Range"). The following For-Each does not work...

For Each cell In Range("Data_Range").Columns(2)
Debug.Print cell.Address
Next cell

For each iteration, this prints the address of the entire named range, not
the address of each cell in the range. Why is that?

The following works using the single-parameter version of Cells()...
For i = 1 To Range("Data_Range").Columns(2).Cells.Count
Debug.Print Range("Data_Range").Columns(2).Cells(i).Value
Next I


Steve