View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
atpgroups atpgroups is offline
external usenet poster
 
Posts: 40
Default Refer to Column with a variable

On 7 May, 18:47, straightedge32
wrote:
Hi. *I would like very much to figure out how to refer to a column using a
variable.


I tend to use Cell(r,c) for this sort of thing.

Sheet1.cells(row,col) is a single cell
Sheet1.cells(row,col).entirecolumn will give you a whole column.
Sheet1.cells(row,col).resize(15,1) will give you the top 15 cells.

Alternatively, you can define a range in terms of the corners, so

Sheet1.Range(Sheet1.Cells(toprow, topcol) , Sheet1.Cells(bottomrow,
bottomcells).Values...

Where row, col, toprow etc are variables.