Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting Last ActiveCell

Status
Not open for further replies.

yumbelie

Programmer
Dec 31, 2002
96
GB
Is it possible to retreive the last activecell the user was in? as opposed to the current one? Thing is, I highlight text if it changed in a box, problem is if the user presses carrige return, or uses the arrow keys to accept the data input, the macro executes on the cell they are now in - not the correct one. E.g. I start in Cell A1 with value "Moon", I change the value to "Sun" and press carriage return, the activecell is now A2 - so the macro then acts upon A2. Normally I'd just take the current row and subtract one, but problem is if the user uses the left arrow, so navigates from A1 to B1, defeats the solution. So what I want is the previous cell visited, so I can act on that one :)

Thanks for any tips

Joseph.
 
If you use the worksheet_change event, you can use the keyword "Target"

This will refer to the cell that was changed
so
Target.text will give you what is currently in the cell that was changed
Target.address will give you the address, Target.row will give you the row etc etc Rgds
Geoff

Si hoc legere scis, nimis eruditionis habes
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top