Solved

Return from where I came in Excel

Posted on 2013-11-08
4
208 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 50

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

735 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