Jon von der Heyden
MrExcel MVP, Moderator
- Joined
- Apr 6, 2004
- Messages
- 10,912
- Office Version
- 365
- Platform
- Windows
Hi,
I have the following code:
Basically this gives me an index of the sheet names in the active workbook. It worked fine until I tried hyperlinking the sheet names to their corresponding sheets. It's overriding the title "Sheet Name" in A1 with "Index". Any ideas why?
Thanks,
Jon
I have the following code:
Code:
Sub List_Ws()
Dim Ws As Worksheet
Sheets.Add
ActiveSheet.Name = "Index"
With Range("A1")
.Value = "Sheet Name"
.Font.bold = True
End With
For Each Ws In ActiveWorkbook.Worksheets
Sheets("Index").Range("A65536").Select
Selection.End(xlUp).Select
With ActiveCell
.Offset(1, 0).Value = Ws.Name
.Hyperlinks.Add Anchor:=Selection, Address:="", _
SubAddress:="'" & Ws.Name & "'!A1", TextToDisplay:=Ws.Name
End With
Next Ws
End Sub
Basically this gives me an index of the sheet names in the active workbook. It worked fine until I tried hyperlinking the sheet names to their corresponding sheets. It's overriding the title "Sheet Name" in A1 with "Index". Any ideas why?
Thanks,
Jon