Solved

Return from where I came in Excel

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

840 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