ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to go back to last used sheet (https://www.excelbanter.com/excel-programming/393086-macro-go-back-last-used-sheet.html)

johan

Macro to go back to last used sheet
 
Hello,

Can somebody help me. I need a macro that activate the forelast used
sheet.

For example: I had done something in sheet 1 and then I jump to sheet
5.
I do some editing in sheet 5 and when I click on the "go back" button
I want automatic jump back to the forelast activated sheet (in this
case sheet 1).

Is there a solution.

regards and thanks,
Johan


[email protected]

Macro to go back to last used sheet
 
On Jul 11, 1:44 pm, johan wrote:
Hello,

Can somebody help me. I need a macro that activate the forelast used
sheet.

For example: I had done something in sheet 1 and then I jump to sheet
5.
I do some editing in sheet 5 and when I click on the "go back" button
I want automatic jump back to the forelast activated sheet (in this
case sheet 1).

Is there a solution.

regards and thanks,
Johan


Johan,

I can't think of an easy way to achieve this since Excel doesn't track
user movements around a workbook in the same way as Internet Explorer
does.

One way to achieve this however would be to put a small piece of code
under the Worksheet_Activate() event on each of your worksheets. The
code could call a public sub eg StoreSheetName which would store the
name of each sheet in a table somewhere.

Then, when your user clicks "Back", you'd link this to a macro which
looks up the 2nd last row of your table. If you only need your "Back"
button to work once, you'd clear the data table at that point, then go
to the sheet name from the 2nd last row.

If you need your "Back" button to work more than once, you'd clear
everything from the 2nd last row onwards (inclusive) then go to the
sheet.

regards

Jeff



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

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