Returning Key Focus

D

Dan Gesshel

Hello.

I am looking for something that will allow me to return the key focus of
the Excel sheet to where it was prior to a procedure running.

I have to activate the cells for this particular loop and I would like
to take the user back to whatever cell they were originally on.

So, I would be looking for something that captures the focus of where
they were, keeps it as a variable and then at the end of my procedure
returns them to their previous spot.

Anyone out there that can help with this?

Thanks.

Dan


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
J

Jeffrey Marcellus

Dan, simply store the start address in a variable, and select that cell
before exiting the macro. Example if you are remaining in the same workbook:

StartCell = ActiveCell.Address
StartSheet = ActiveSheet.Name
....macro fun...
Sheets(StartSheet).Select
Range(StartCell).Select

Hope this helps... Jeff
 

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