#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 51
Default Hyperlink

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
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 793
Default Hyperlink

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

" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert hyperlink function into hyperlink Pai Excel Worksheet Functions 4 November 10th 08 03:29 PM
Can't make hyperlink function work for hyperlink to website Frank B Denman Excel Worksheet Functions 15 February 5th 07 11:01 PM
How do I create a hyperlink to a cell with the hyperlink function S. Bevins Excel Worksheet Functions 2 July 20th 06 08:06 PM
Moving rows with Hyperlink doesn't move hyperlink address Samad Excel Discussion (Misc queries) 15 June 22nd 06 12:03 PM
Intra-workbook hyperlink: macro/function to return to hyperlink ce marika1981 Excel Discussion (Misc queries) 3 May 6th 05 05:47 AM


All times are GMT +1. The time now is 01:54 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"