Can the column index in a cell address be made variable?

C

cyberdude

Hi,

To refer to a cell with a variable row number, we can just code it as,
for example,

Dim i As Interger
i=234
Range("A" & i).Select

To refer to a cell with a variable column index, it seems not that easy
because the column
index must be explicitly specified in a cell address. So, if I want to
go to the j th column on the 2nd row or j columns to the right of cell
AA3, is there a quick and easy way to do it? Thank you in advance.


David
 
J

Jezebel

If you just want a single cell, use MySheet.Cells(i,j).
If you want a range, you can use

with MySheet
.Range(.Cells(i1,j1), .Cells(i2,j2))....
end with
 
D

Dave Peterson

don't forget to check your post in .misc.
Hi,

To refer to a cell with a variable row number, we can just code it as,
for example,

Dim i As Interger
i=234
Range("A" & i).Select

To refer to a cell with a variable column index, it seems not that easy
because the column
index must be explicitly specified in a cell address. So, if I want to
go to the j th column on the 2nd row or j columns to the right of cell
AA3, is there a quick and easy way to do it? Thank you in advance.

David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top