Offset indeterminate amount

R

robzrob

Hello

I have a cell selected, but I don't know where it will be and I want to go from it to the cell which is in the same row but in column M. Because of this, I can't use OFFSET(Y,X), because I won't know what X and Y will need to be.

Cheers
 
A

Auric__

robzrob said:
I have a cell selected, but I don't know where it will be and I want to
go from it to the cell which is in the same row but in column M.
Because of this, I can't use OFFSET(Y,X), because I won't know what X
and Y will need to be.

Since it's *always* column M, you can hardcode that bit of info into your
formula/code.

As a spreadsheet formula, you could do something like this:
=INDIRECT(ADDRESS(ROW(),13))
(But test & adjust that to suit your needs; I'm not very good with
spreadsheet functions.)

In VBA, I'd probably do this:
Cells(ActiveCell.Row, 13).Select

For both VBA and spreadsheet formulae there are other ways; you might want to
do some investigating. Open the "insert function" dialog and search for
"offset" to start.
 
R

robzrob

robzrob wrote:









Since it's *always* column M, you can hardcode that bit of info into your

formula/code.



As a spreadsheet formula, you could do something like this:

=INDIRECT(ADDRESS(ROW(),13))

(But test & adjust that to suit your needs; I'm not very good with

spreadsheet functions.)



In VBA, I'd probably do this:

Cells(ActiveCell.Row, 13).Select



For both VBA and spreadsheet formulae there are other ways; you might want to

do some investigating. Open the "insert function" dialog and search for

"offset" to start.



Thank you, that looks as though it will do very well.
 

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