Hyperlink

F

fi.or.jp.de

Hi All,

I have 10 sheets and all the sheets name are in sheet1
col A.
I want to create hyperlinks.
eg.col A
Asset
Liability

If I click asset it moves to the sheet named Asset.

I am using this macro it works fine, but if any space in sheet names
it gives
error.

Sub hyp()
For i = 1 To 3
shtn = Cells(i, 1).Value
Cells(i, 1).Select
Selection.Hyperlinks.Add Anchor:=Selection, Address:="",
SubAddress:= _
shtn & "!A1", TextToDisplay:=shtn
Next
End Sub
 
S

Sheeloo

You need to put '' around the sheetname if it contains spaces...
Try
Sub hyp()
For i = 1 To 3
shtn = Cells(i, 1).Value
Cells(i, 1).Select
Selection.Hyperlinks.Add Anchor:=Selection, Address:="", _
SubAddress:="'" & shtn & "'!A1", TextToDisplay:=shtn
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top