Select Worksheet and Hide Current Worksheet using Hyperlink

DKrout2018

Board Regular
Joined
Mar 3, 2015
Messages
64
I have a workbook that contains 3 worksheets:
  1. Table of Contents ("TOC")
  2. Budget Summary ("Summary")
  3. Project Details ("Project")

I want to use hyperlinks/VBA code to select/hide worksheets from the Table of Contents worksheet. So the only worksheet that I want to be visible in the workbook is the TOC Worksheet. And use the hyperlinks on the TOC worksheet to navigate to the other/hidden worksheets.

How can I include a hyperlink on the "Summary" and "Project" worksheets that will hide that worksheet and go back to the TOC worksheet?
 
I suggest this:


These are auto sheet event scripts
Your Workbook must be Macro enabled
To install this code:
Right-click on the sheet tab
Select View Code from the pop-up context menu
Paste the code in the VBA edit window



On sheet named "TOC"
1.Put this script in that sheet.
2. Enter the value "Summary" in Range("A1")

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
If Target.Column = 1 And Target.Row = 1 And Target.Value = "Summary" Then Sheets(Target.Value).Visible = True
End Sub


On sheet named "Summary"
1. Put this script in that sheet.
2. Put the value "TOC" in Range("A1")
3. Put the value "Details" in Range("A2")

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
If Target.Column = 1 And Target.Row = 1 And Target.Value = "TOC" Then ActiveSheet.Visible = False: Sheets(Target.Value).Activate
If Target.Column = 1 And Target.Row = 2 And Target.Value = "Details" Then Sheets(Target.Value).Visible = True: Sheets(Target.Value).Activate
End Sub


On Sheet named "Details"
1. Put this script in that sheet.
2. Put the value "Summary" in Range("A1")

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
If Target.Column = 1 And Target.Row = 1 And Target.Value = "Summary" Then ActiveSheet.Visible = False: Sheets(Target.Value).Activate
End Sub



Now when you double click on those cells in the sheets mentioned the script will do what you want.
So you need to double click on "Details" or "Summary" or "TOC"

For "aesthetic" you can color the cells or change the font. Nothing happens until you double click on the cell.


See how this works for you and let me know if this will work for you.
 
Upvote 0

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

Forum statistics

Threads
1,223,912
Messages
6,175,341
Members
452,638
Latest member
Oluwabukunmi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top