View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Auric__ Auric__ is offline
external usenet poster
 
Posts: 538
Default Offset indeterminate amount

robzrob wrote:

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.

--
The cinema is not a slice of life but a piece of cake.