The code below keeps giving me syntax error whenever I run to this line: Range(“SheetList[Worksheet Index]”).Select
:
Private Sub Worksheet_Activate()
Dim sheet As Object
Dim SheetName As String
On Error GoTo Error
With Sheets("Index").ListObjects("SheetList")
If Not .DataBodyRange Is Nothing Then
.DataBodyRange.Delete
End If
End With
Range("SheetList[Worksheet Index]").Select '<--------- syntax error
For Each sheet In Sheets
SheetName = sheet.Name
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", _
SubAddress:=SheetName & "!A1", _
TextToDisplay:=SheetName
ActiveCell.Offset(1, 0).Select
Next sheet
Exit Sub
Error:
MsgBox "Unable to create index"
End Sub
I already created the SheetList
table and Index
sheet.
Can anyone help me figure this out?