Solved

Using a cell to open an existing worksheet in Excel

Posted on 2011-03-14
4
314 Views
Last Modified: 2012-05-11
Is there a way that when a user would click on a cell, that it could open an existing worksheet within the same file?  Instead of having the user find the correct worksheet, a master list could be created and displayed, and then the user would just 'click' the one they wanted?  If so, how could it be done.  If not, thanks for letting me know.
0
Comment
Question by:rivercity
  • 2
4 Comments
 
LVL 13

Accepted Solution

by:
AustinComputerLabs earned 500 total points
ID: 35132489
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 35132608
If n a workbook you right click on a tab and select view code.  Now insert  a code module and post the following snippet.

When you run the code it will create a new sheet as a table of contents with hyperlinks automatically

Chris
Sub Hyper()
Dim TOC As Worksheet
Dim sh As Object

    On Error Resume Next
    Set TOC = ThisWorkbook.Worksheets("TOC")
    On Error GoTo 0
    If TOC Is Nothing Then
        Set TOC = ThisWorkbook.Worksheets.Add(Before:=ThisWorkbook.Sheets(1))
        TOC.Name = "TOC"
    End If
    TOC.Move Before:=ThisWorkbook.Sheets(1)
    TOC.Cells.Delete
    TOC.Range("A1") = "Worksheet(s)"
    For Each sh In ThisWorkbook.Worksheets
'        TOC.Range("a" & TOC.Rows.Count).End(xlUp).Offset(1, 0) = sh.Name
        TOC.Hyperlinks.Add Anchor:=TOC.Range("a" & TOC.Rows.Count).End(xlUp).Offset(1, 0), _
            Address:="", SubAddress:=VBA.Chr(39) & sh.Name & VBA.Chr(39) & "!A1"
    Next
    TOC.Columns(1).AutoFit

End Sub

Open in new window

0
 

Author Closing Comment

by:rivercity
ID: 35133300
sometimes it's just hard to find the right things.

works perfect.
0
 
LVL 13

Expert Comment

by:AustinComputerLabs
ID: 35133310
Thank you for your support.
Master Certification obtained with your answer!!
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

My experience with Windows 10 over a one year period and suggestions for smooth operation
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 Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

679 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