#1   Report Post  
Posted to microsoft.public.excel.misc
Graham F
 
Posts: n/a
Default Hyperlinks

I need to make a hyperlink year independant, I want to concatenate a string,
place it in a cell and access that from VBA. I thought this instruction might
be useful, Worksheets(1).Range("E16").Hyperlinks.Item(1).Foll ow but of course
the concatenated string is not a hyperlink. Any help & advice would be
appreciated. As you might guess I am new to this. Many thanks Graham

  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Hyperlinks

maybe...

ActiveWorkbook.FollowHyperlink _
Address:=Worksheets(1).Range("E16").Hyperlinks(1). Address



Graham F wrote:

I need to make a hyperlink year independant, I want to concatenate a string,
place it in a cell and access that from VBA. I thought this instruction might
be useful, Worksheets(1).Range("E16").Hyperlinks.Item(1).Foll ow but of course
the concatenated string is not a hyperlink. Any help & advice would be
appreciated. As you might guess I am new to this. Many thanks Graham


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student
 
Posts: n/a
Default Hyperlinks

Inserting a hyperlink in a cell is easy:

Sub hyperset()
ActiveSheet.Hyperlinks.Add Anchor:=Selection,
Address:="http://www.google.com", TextToDisplay:="Google"
End Sub


How about two steps:

1. Put you concatenated string in the worksheet (say cell B2)

2. Enter and run:

Sub hyperset2()
dim s as string
s=cells(2,2).value
ActiveSheet.Hyperlinks.Add Anchor:=Range("B3"), Address:=s,
TextToDisplay:="Goodwords"
End Sub

So:
B2 has your concocted (concatenated) URL
B3 has the inserted hyperlink

B3 can be followed by a click or from VBA
--
Gary's Student


"Graham F" wrote:

I need to make a hyperlink year independant, I want to concatenate a string,
place it in a cell and access that from VBA. I thought this instruction might
be useful, Worksheets(1).Range("E16").Hyperlinks.Item(1).Foll ow but of course
the concatenated string is not a hyperlink. Any help & advice would be
appreciated. As you might guess I am new to this. Many thanks Graham

  #4   Report Post  
Posted to microsoft.public.excel.misc
Graham F
 
Posts: n/a
Default Hyperlinks

Hi Dave, Many thanks for the sugestion, when I enter the code it comes up
with the subscript out of range error No 9? Any suggestions as worksheets 1
exists as does cell e16! Graham

"Dave Peterson" wrote:

maybe...

ActiveWorkbook.FollowHyperlink _
Address:=Worksheets(1).Range("E16").Hyperlinks(1). Address



Graham F wrote:

I need to make a hyperlink year independant, I want to concatenate a string,
place it in a cell and access that from VBA. I thought this instruction might
be useful, Worksheets(1).Range("E16").Hyperlinks.Item(1).Foll ow but of course
the concatenated string is not a hyperlink. Any help & advice would be
appreciated. As you might guess I am new to this. Many thanks Graham


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default Hyperlinks

So the name of the hyperlink is just the value in the cell?

ActiveWorkbook.FollowHyperlink _
Address:=Worksheets(1).Range("e16").Value

or

ActiveWorkbook.FollowHyperlink _
Address:="http://" & Worksheets(1).Range("e16").Value

If that doesn't work, post back with the value that's in that cell.

Graham F wrote:

Hi Dave, Many thanks for the sugestion, when I enter the code it comes up
with the subscript out of range error No 9? Any suggestions as worksheets 1
exists as does cell e16! Graham

"Dave Peterson" wrote:

maybe...

ActiveWorkbook.FollowHyperlink _
Address:=Worksheets(1).Range("E16").Hyperlinks(1). Address



Graham F wrote:

I need to make a hyperlink year independant, I want to concatenate a string,
place it in a cell and access that from VBA. I thought this instruction might
be useful, Worksheets(1).Range("E16").Hyperlinks.Item(1).Foll ow but of course
the concatenated string is not a hyperlink. Any help & advice would be
appreciated. As you might guess I am new to this. Many thanks Graham


--

Dave Peterson


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.misc
Graham F
 
Posts: n/a
Default Hyperlinks

Hi Dave,

Works just fine now, many thanks for your time. Best wishes, Graham

"Dave Peterson" wrote:

So the name of the hyperlink is just the value in the cell?

ActiveWorkbook.FollowHyperlink _
Address:=Worksheets(1).Range("e16").Value

or

ActiveWorkbook.FollowHyperlink _
Address:="http://" & Worksheets(1).Range("e16").Value

If that doesn't work, post back with the value that's in that cell.

Graham F wrote:

Hi Dave, Many thanks for the sugestion, when I enter the code it comes up
with the subscript out of range error No 9? Any suggestions as worksheets 1
exists as does cell e16! Graham

"Dave Peterson" wrote:

maybe...

ActiveWorkbook.FollowHyperlink _
Address:=Worksheets(1).Range("E16").Hyperlinks(1). Address



Graham F wrote:

I need to make a hyperlink year independant, I want to concatenate a string,
place it in a cell and access that from VBA. I thought this instruction might
be useful, Worksheets(1).Range("E16").Hyperlinks.Item(1).Foll ow but of course
the concatenated string is not a hyperlink. Any help & advice would be
appreciated. As you might guess I am new to this. Many thanks Graham

--

Dave Peterson


--

Dave Peterson

  #7   Report Post  
Posted to microsoft.public.excel.misc
Graham F
 
Posts: n/a
Default Hyperlinks

Hi Gary"s Student,

Many thanks for you help, works fine in Excel 2000.

Best wishes

Graham

"Gary''s Student" wrote:

Inserting a hyperlink in a cell is easy:

Sub hyperset()
ActiveSheet.Hyperlinks.Add Anchor:=Selection,
Address:="http://www.google.com", TextToDisplay:="Google"
End Sub


How about two steps:

1. Put you concatenated string in the worksheet (say cell B2)

2. Enter and run:

Sub hyperset2()
dim s as string
s=cells(2,2).value
ActiveSheet.Hyperlinks.Add Anchor:=Range("B3"), Address:=s,
TextToDisplay:="Goodwords"
End Sub

So:
B2 has your concocted (concatenated) URL
B3 has the inserted hyperlink

B3 can be followed by a click or from VBA
--
Gary's Student


"Graham F" wrote:

I need to make a hyperlink year independant, I want to concatenate a string,
place it in a cell and access that from VBA. I thought this instruction might
be useful, Worksheets(1).Range("E16").Hyperlinks.Item(1).Foll ow but of course
the concatenated string is not a hyperlink. Any help & advice would be
appreciated. As you might guess I am new to this. Many thanks Graham

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
Relative Hyperlinks to local files CR Optiker Links and Linking in Excel 3 April 5th 06 06:05 AM
hyperlinks in different drives cdroot4383 Excel Discussion (Misc queries) 2 January 5th 06 07:35 PM
Losing hyperlinks RedChip Excel Discussion (Misc queries) 0 November 30th 05 10:56 AM
Picture hyperlinks don't work when publishing to web...? norders Excel Discussion (Misc queries) 0 November 25th 05 01:29 PM
Why do long hyperlinks get truncated on save in Excel? colerb Excel Worksheet Functions 1 June 13th 05 10:37 PM


All times are GMT +1. The time now is 12:38 PM.

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

About Us

"It's about Microsoft Excel"