Offset indeterminate amount

  • Thread starter Thread starter robzrob
  • Start date Start date
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
 
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.
 
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.
 
Back
Top