![]() |
Macro to return user to previously viewed sheet
Is there a way to create a macro that, when assigned to a button and clicked,
it will return the user to the worksheet (within the same workbook) they were previously viewing? I have a workbook with several worksheets and it is getting difficult to navigate each sheet. I have tried to include hyperlinks to facilitate page navigation, but if someone can't remember what sheet they were just looking at, it would be helpful to have a "back" button to take you "back" to the sheet you just navigated away from. |
Macro to return user to previously viewed sheet
Hi,
You need to store the name of the sheet you just left using this Private Sub Workbook_SheetDeactivate(ByVal Sh As Object) Sheets("Sheet1").Range("A1").Value = Sh.Name End Sub Then create a button and copy it to each worksheet that has this code Sub Button1_Click() Sheets(Sheets("Sheet1").Range("A1").Value).Activat e End Sub Mike "Taylor" wrote: Is there a way to create a macro that, when assigned to a button and clicked, it will return the user to the worksheet (within the same workbook) they were previously viewing? I have a workbook with several worksheets and it is getting difficult to navigate each sheet. I have tried to include hyperlinks to facilitate page navigation, but if someone can't remember what sheet they were just looking at, it would be helpful to have a "back" button to take you "back" to the sheet you just navigated away from. |
Macro to return user to previously viewed sheet
Ok, I should have mentioned knowing nothing about being new to macros and
knowing nothing about VB. What do you mean when you say "store the name of the sheet". Is this program designed to only navigate back to a page that I designate within the macro? Or will it navigate back freely? "Mike H" wrote: Hi, You need to store the name of the sheet you just left using this Private Sub Workbook_SheetDeactivate(ByVal Sh As Object) Sheets("Sheet1").Range("A1").Value = Sh.Name End Sub Then create a button and copy it to each worksheet that has this code Sub Button1_Click() Sheets(Sheets("Sheet1").Range("A1").Value).Activat e End Sub Mike "Taylor" wrote: Is there a way to create a macro that, when assigned to a button and clicked, it will return the user to the worksheet (within the same workbook) they were previously viewing? I have a workbook with several worksheets and it is getting difficult to navigate each sheet. I have tried to include hyperlinks to facilitate page navigation, but if someone can't remember what sheet they were just looking at, it would be helpful to have a "back" button to take you "back" to the sheet you just navigated away from. |
All times are GMT +1. The time now is 09:48 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com