Solved

Using a cell to open an existing worksheet in Excel

Posted on 2011-03-14
4
310 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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,…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

867 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now