Solved

Return from where I came in Excel

Posted on 2013-11-08
4
212 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 51

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

Independent Software Vendors: 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

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
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…

734 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