VBScript to create sheet with links to other worksheets in the same workbook

Posted on 2012-09-19
Last Modified: 2012-09-20
I'm trying to create a table of contents page in a spreadsheet. I need help creating a vbscript that will loop through a workbook and create a table of contents page that has a link to each worksheet in the workbook.
Question by:abgtemp
    1 Comment

    Accepted Solution

    I actually figured it out.

    Set objWSheet = objExcel.ActiveWorkBook.WorkSheets("Contents")
    row = 1		'Set Initial Row
    For Each sht In objExcel.ActiveWorkbook.Sheets
    objWSheet.Cells(row, 1) = sht.Name
    objWSheet.Hyperlinks.Add objWSheet.Cells(row, 1),"", "'" & sht.Name & "'!A1"
    row = row + 1

    Open in new window


    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    In this article we want to have a look at the directory attributes which are used by Microsoft to store the so called Security Identifiers (SID). These SIDs plays an important role in delegating and granting permissions and in authentication of trus…
    Well hello again!  Glad to see you've made it this far without giving up.  In this, the fourth installment of my popular series, I'm going to cover functions and subroutines, what they are, and why they are useful.  Just in case you stumbled onto th…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    755 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

    24 Experts available now in Live!

    Get 1:1 Help Now