View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff Harald Staff is offline
external usenet poster
 
Posts: 1,327
Default hyperlink made easy???

Hi

This is a quick start that can (and probably should) be refined for days:

Sub MakeLinks()
Dim R1 As Range, R2 As Range
Dim N1 As String, N2 As String

On Error Resume Next

Set R1 = Application.InputBox("Click cell 1", _
"Link between cells", _
Selection.Address, , , , , 8)
If R1 Is Nothing Then Exit Sub
Set R1 = R1(1)
N1 = InputBox("Decide a name for " & _
R1.Address & ":")
If N1 = "" Then Exit Sub

Set R2 = Application.InputBox("Click cell 2", _
"Link between cells", _
Selection.Address, , , , , 8)
If R2 Is Nothing Then Exit Sub
Set R2 = R2(1)
N2 = InputBox("Decide a name for " & _
R2.Address & ":")
If N2 = "" Then Exit Sub

ActiveWorkbook.Names.Add _
Name:=N1, RefersTo:="=" & _
R1.Parent.Name & "!" & _
R1.Address

ActiveWorkbook.Names.Add _
Name:=N2, RefersTo:="=" & _
R2.Parent.Name & "!" & _
R2.Address

R1.Parent.Hyperlinks.Add Anchor:=R1, _
Address:="", _
SubAddress:=N2, TextToDisplay:="Goto " & N2

R2.Parent.Hyperlinks.Add Anchor:=R2, _
Address:="", _
SubAddress:=N1, TextToDisplay:="Goto " & N1

End Sub

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"index" wrote in message
...
Is there an easy way in excel to simply click on a cell in excel,
instruct excel that you want to create a hyperlink and then simply
select the cell to link to in the workbook?

Alternatively does anyone know how to create a macro that will instruct
the user to enter two cell references which will then be automatically
linked to each other?

If you imagine you are dealing with the most simple excel user you
won't be far wrong!!!! Thanks for any help!


---
Message posted from http://www.ExcelForum.com/