how do I get the current cursor position in a spreedsheet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm wanting to use the current cursor position in a formula but have looked
at all the possibles like ROW, CELL, INFO with no luck.... but yet I can see
it right there in the NAME BOX... just can't get at it !!!!
 
Hi Paul J

Selection.Column will give you the column number of the selected cell
Selection.Row will give the row number
ActiveCell.Address will give the absolute cell address i.e. "$A$1"
 
The closest standard function that gives what you ask is the Cell function.
However, it only updates when there is a change in the worksheet that
triggers a recalc, not when the cursor position changes.

=Cell("Address")

This will return the address of the active cell when a recalc takes place.
When you enter data or press F9, for example.

You could also write your own function in VBA code that uses
ActiveCell.Address to return the cursor address. However, you would need to
declare the function Volatile and it also would only update on a recalc.

The only way to trap the cursor address when it changes is to write code for
the SelectionChange event.
 
Ah... just tried it... also had to learn VB to do it !!!
unfortunately I wanted somthing that would continue to update as I move the
cursor around :(
 
Back
Top