link to a hyperlink cell

R

README.TXT

It is not so good but works:



A1 = hyperlink ("URL";"URL")
-> So the link will appear as the
URL itself

Then:

A2 = hyperlink(A1)




Greetings,

readme.txt
 
D

David McRitchie

The problem was to have the same hyperlink in A2 as in A1,
and there is no Excel solution for that. You would need to use
a User Defined Function, or possibly an Event Macro.

With more details as to how you create the hyperlink in A1,
there might be better alternatives for doing the same for A2.
Some ideas follow:

with concatentaion you could use
E1: 'google
A1: =HYPERLINK("http://www." & E1 & ".com",E1)
A2: =HYPERLINK("http://www." & A1 & ".com",A1)

with an Event Macro such as the following --
to install: right-click on worksheet tab, view code,
insert code (only have one option explicit and it must
be the first line). This way you can double-click
of what you see i.e. the word "google" and hyperlink
out to "http://www.google.com" in a new window.
Close the window and you your Excel applicaiton should
again be the active window.

Option Explicit
Private Sub Worksheet_BeforeDoubleClick(ByVal _
Target As Range, Cancel As Boolean)
Dim hlink As String
Cancel = True 'Get out of edit mode
'If Target.Column <> 1 Then Exit Sub
hlink = "http://www." & Target.Text & ".com"
ActiveWorkbook.FollowHyperlink _
Address:=hlink, NewWindow:=True
End Sub

Another example perhaps a little closer to what you had so that
you don't simple repeat the hyperlink name shown in another cell.
If [x] is not clear that it is a link use [link]

A1: 'google
B1: =HYPERLINK("http://www." & A1 & ".com","[x]")
A2: =A1
B2: =HYPERLINK("http://www." & A2 & ".com","[x]")

Additional references:
http://www.mvps.org/dmcritchie/excel/sheets.htm#hyperlink
http://www.mvps.org/dmcritchie/excel/event.htm#followhyperlink
http://www.mvps.org/dmcritchie/excel/buildtoc.htm#hyperlink
http://www.mvps.org/dmcritchie/excel/posting.htm#useyourname
 
J

J.

Thanks

David McRitchie said:
The problem was to have the same hyperlink in A2 as in A1,
and there is no Excel solution for that. You would need to use
a User Defined Function, or possibly an Event Macro.

With more details as to how you create the hyperlink in A1,
there might be better alternatives for doing the same for A2.
Some ideas follow:

with concatentaion you could use
E1: 'google
A1: =HYPERLINK("http://www." & E1 & ".com",E1)
A2: =HYPERLINK("http://www." & A1 & ".com",A1)

with an Event Macro such as the following --
to install: right-click on worksheet tab, view code,
insert code (only have one option explicit and it must
be the first line). This way you can double-click
of what you see i.e. the word "google" and hyperlink
out to "http://www.google.com" in a new window.
Close the window and you your Excel applicaiton should
again be the active window.

Option Explicit
Private Sub Worksheet_BeforeDoubleClick(ByVal _
Target As Range, Cancel As Boolean)
Dim hlink As String
Cancel = True 'Get out of edit mode
'If Target.Column <> 1 Then Exit Sub
hlink = "http://www." & Target.Text & ".com"
ActiveWorkbook.FollowHyperlink _
Address:=hlink, NewWindow:=True
End Sub

Another example perhaps a little closer to what you had so that
you don't simple repeat the hyperlink name shown in another cell.
If [x] is not clear that it is a link use [link]

A1: 'google
B1: =HYPERLINK("http://www." & A1 & ".com","[x]")
A2: =A1
B2: =HYPERLINK("http://www." & A2 & ".com","[x]")

Additional references:
http://www.mvps.org/dmcritchie/excel/sheets.htm#hyperlink
http://www.mvps.org/dmcritchie/excel/event.htm#followhyperlink
http://www.mvps.org/dmcritchie/excel/buildtoc.htm#hyperlink
http://www.mvps.org/dmcritchie/excel/posting.htm#useyourname
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm
 
D

David McRitchie

You're welcome, but I think since you got at least four
different possibilities it would be helpful to know how
close any of the answers were to what you wanted. (feedback)
 
Top