Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Return from where I came in Excel

Posted on 2013-11-08
4
Medium Priority
?
222 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 52

Accepted Solution

by:
Rgonzo1971 earned 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

688 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