[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 870
  • Last Modified:

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

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.
1 Solution
abgtempAuthor Commented:
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now