Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How Do I insert Hyperlink to sheet in my workbook

Status
Not open for further replies.

DavCl

Programmer
Oct 12, 2010
3
0
0
GB
Hi

How do I write code to insert a list of hyperlinks on sheet1 of my workbook, linking to all other sheets when clicked

I have got this code

Sub Macro3()
rw = 1
For Each sh In Sheets
rw = rw + 1
Cells(rw, 1).Select
If sh.Name <> "Sheet1" Then
ActiveSheet.Hyperlinks.Add Anchor:=Cells(rw, 1), Address:="", SubAddress:= _
sh.Name & "!A1", TextToDisplay:=sh.Name
End If
Next sh
End Sub

When clicked I get the error "Reference is not valid"
Can anyone help....
 



hi,

Your code works correctly as written.

Do you actually have a Sheet1???

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top