I am trying to create a hyperlink of various worksheets on a table of contents using visual basic.
The first sheet is the table of contents. The worksheets to be included in the table of contents therefore start at worksheet2. I am unablet to change the array to begin at worksheet 2.
These are my lines of code
'Create Table of Contents
' Create array with locations
Set firstsheet = Worksheet(2).Value
' Dim arrworksheets(2 To Worksheets.Count) As Long
For x = arr(firstsheet) To UBound(myArray)
Set sht = Worksheets(myArray(x))
sht.Activate
With Content_sht
.Hyperlinks.Add .Cells(x + 2, 3), "", _
SubAddress:="'" & sht.Name & "'!A1", _
TextToDisplay:=sht.Name
.Cells(x + 2, 2).Value = x
End With
Next x
Thank you so much in advance!
See Question&Answers more detail:os