Solved

Return from where I came in Excel

Posted on 2013-11-08
4
177 Views
Last Modified: 2013-11-08
Folks,
I have a workbook with several hundred worksheets. From time to time I make a reference to addtional information that can be found in another worksheet within the same workbook using hyperlink. That's working OK. When the user is done with the worksheet I send them back to the Main Menu by way of a command button.
I do not know which worksheets will have hyperlinks to different worksheets, but I was wondering:
Is there a way to send the user back to the worksheet that the hyperlink exits, rather than the Main Menu?
I expect to have half-dozen of these depending upon the additional information that is provided on he hyperlinked worksheet.
0
Comment
Question by:Frank Freese
  • 3
4 Comments
 
LVL 48

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 39633956
Hi,

you could put this code in a normal module

Global LastVisitedSheet As String

Sub GoToLastVisitedSheet()
   Sheets(LastVisitedSheet).Activate
End Sub

Open in new window

Then put this in the ThisWorkbook module:

Sub Workbook_SheetDeactivate(ByVal sh As Object)
    LastVisitedSheet = sh.Name
End Sub

Open in new window

and assign a macro to the GoToLastVisitedSheet

Regards
0
 

Author Comment

by:Frank Freese
ID: 39634031
Interesting....
Let's see how this play out
0
 

Author Comment

by:Frank Freese
ID: 39634059
OK - you nailed it.
That's pretty neat
Thanks a lot!
0
 

Author Closing Comment

by:Frank Freese
ID: 39634067
Thank you
Greatly appreciated
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now