ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Returning Key Focus (https://www.excelbanter.com/excel-programming/276202-returning-key-focus.html)

Dan Gesshel

Returning Key Focus
 

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!

Jeffrey Marcellus

Returning Key Focus
 
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

"Dan Gesshel" wrote in message
...

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!





All times are GMT +1. The time now is 07:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com