Macro to return user to previously viewed sheet

T

Taylor

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.
 
M

Mike H

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).Activate
End Sub

Mike
 
T

Taylor

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?
 

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