ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hyperlink macro for personal.xls (https://www.excelbanter.com/excel-programming/347604-hyperlink-macro-personal-xls.html)

al007

Hyperlink macro for personal.xls
 
Sub Hyperlinkcell()
'
Dim actual As Range

Set actual = Application.InputBox(Prompt:="Select cell to
hyperlink.", Type:=8)
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="",
SubAddress:=actual, TextToDisplay:=ActiveCell.Value
End Sub

Can anybody fix the above hyperlink macro pls.

Thxs


Norman Jones

Hyperlink macro for personal.xls
 
Hi Al007,

Try:

'=============
Public Hyperlinkcell()
Dim actual As Range

Set actual = Application. _
InputBox(Prompt:="Select cell to hyperlink.", _
Type:=8)
'

ActiveSheet.Hyperlinks.Add _
Anchor:=Selection, _
Address:="", _
SubAddress:=actual.Address(0, 0)
End Sub
'<<=============

---
Regards,
Norman


"al007" wrote in message
ups.com...
Sub Hyperlinkcell()
'
Dim actual As Range

Set actual = Application.InputBox(Prompt:="Select cell to
hyperlink.", Type:=8)
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="",
SubAddress:=actual, TextToDisplay:=ActiveCell.Value
End Sub

Can anybody fix the above hyperlink macro pls.

Thxs




al007

Hyperlink macro for personal.xls
 
Thxs - but it does not work if a cell from a different sheet is
selected - can you help pls


Tom Ogilvy

Hyperlink macro for personal.xls
 
Sub Hyperlinkcell()
'
Dim actual As Range

Set actual = Application.InputBox( _
Prompt:="Select cell to hyperlink.", Type:=8)
ActiveSheet.Hyperlinks.Add _
Anchor:=Selection, _
Address:="", _
SubAddress:="'" & actual.Parent.Name & _
"'!" & actual.Address(0, 0), _
TextToDisplay:=actual.Text
End Sub


--
Regards,
Tom Ogilvy


"al007" wrote in message
ups.com...
Sub Hyperlinkcell()
'
Dim actual As Range

Set actual = Application.InputBox(Prompt:="Select cell to
hyperlink.", Type:=8)
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="",
SubAddress:=actual, TextToDisplay:=ActiveCell.Value
End Sub

Can anybody fix the above hyperlink macro pls.

Thxs




Tom Ogilvy

Hyperlink macro for personal.xls
 
Here is a slight revision

Sub Hyperlinkcell()
'
Dim actual As Range
Dim Act_Cell as Range
set Act_Cell = ActiveCell
Set actual = Application.InputBox( _
Prompt:="Select cell to hyperlink.", Type:=8)
ActiveSheet.Hyperlinks.Add _
Anchor:=Act_Cell, _
Address:="", _
SubAddress:="'" & actual.Parent.Name & _
"'!" & actual.Address(0, 0), _
TextToDisplay:=actual.Parent.Name & _
"!" & actual.Address(0, 0)
End Sub

--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
Sub Hyperlinkcell()
'
Dim actual As Range

Set actual = Application.InputBox( _
Prompt:="Select cell to hyperlink.", Type:=8)
ActiveSheet.Hyperlinks.Add _
Anchor:=Selection, _
Address:="", _
SubAddress:="'" & actual.Parent.Name & _
"'!" & actual.Address(0, 0), _
TextToDisplay:=actual.Text
End Sub


--
Regards,
Tom Ogilvy


"al007" wrote in message
ups.com...
Sub Hyperlinkcell()
'
Dim actual As Range

Set actual = Application.InputBox(Prompt:="Select cell to
hyperlink.", Type:=8)
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="",
SubAddress:=actual, TextToDisplay:=ActiveCell.Value
End Sub

Can anybody fix the above hyperlink macro pls.

Thxs






al007

Hyperlink macro for personal.xls
 
Thxs tom,
Your code is working great & am using it for empty cells & using
SubAddress:=activecell.value for non empty cells with an if statement
cheers!!!



Tom Ogilvy wrote:
Here is a slight revision

Sub Hyperlinkcell()
'
Dim actual As Range
Dim Act_Cell as Range
set Act_Cell = ActiveCell
Set actual = Application.InputBox( _
Prompt:="Select cell to hyperlink.", Type:=8)
ActiveSheet.Hyperlinks.Add _
Anchor:=Act_Cell, _
Address:="", _
SubAddress:="'" & actual.Parent.Name & _
"'!" & actual.Address(0, 0), _
TextToDisplay:=actual.Parent.Name & _
"!" & actual.Address(0, 0)
End Sub

--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
Sub Hyperlinkcell()
'
Dim actual As Range

Set actual = Application.InputBox( _
Prompt:="Select cell to hyperlink.", Type:=8)
ActiveSheet.Hyperlinks.Add _
Anchor:=Selection, _
Address:="", _
SubAddress:="'" & actual.Parent.Name & _
"'!" & actual.Address(0, 0), _
TextToDisplay:=actual.Text
End Sub


--
Regards,
Tom Ogilvy


"al007" wrote in message
ups.com...
Sub Hyperlinkcell()
'
Dim actual As Range

Set actual = Application.InputBox(Prompt:="Select cell to
hyperlink.", Type:=8)
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="",
SubAddress:=actual, TextToDisplay:=ActiveCell.Value
End Sub

Can anybody fix the above hyperlink macro pls.

Thxs






All times are GMT +1. The time now is 05:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com