Refer to Column with a variable
Great, that gets me much closer. So I can use the Cell(r, c) notation to
successfully set a range. So...
Set myRange = wrksht.Range(wrksht.Cells(nCurrRow, 8), wrksht.Cells(nCurrRow,
16)).... etc.
But how do I use this range to calculate a value or put it in a formula?
So I'd like cell (nCurrRow, 17) for instance to be the average of myRange.
Where would I go next? I'd like to be able to put it into a value as well as
to use it as a formula (for autoupdating, etc).
Thank you all very much for your help. Sorry to be so lame at this.
-Mike
"atpgroups" wrote:
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.
|