Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default 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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Previously viewed docs SWeaklend11 Excel Discussion (Misc queries) 1 August 29th 07 04:39 PM
Help with Macro. -- User input for sheet name Michael A Excel Programming 9 January 6th 06 03:17 PM
Macro to return to Current Sheet and Cell Steve Klenner Excel Programming 2 September 28th 05 02:38 PM
Return to Current Sheet in On (sheet activate) event macro Paul Moles Excel Programming 1 March 27th 05 03:16 PM
Macro not found when spreadsheet viewed in Internet Explorer? Ben Excel Discussion (Misc queries) 1 February 10th 05 07:31 PM


All times are GMT +1. The time now is 05:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"