#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 110
Default Hyperlink to code

Following on from my last post, what I would really like is
- to have a hyperlink-type text in a cell, so that when you mouse over it,
it becomes a hand icon
- but instead of linking this to a file or webpage, I want it to run a maco.

Is this possible?

Thanks
Daniel
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Hyperlink to code

Daniel,


Put some text in a cell (This uses A1) and then
Insert|Hyperlink
for the address put the cell the 'hyperlink is in i.e it goes nowhere a
circular hyperlink.

The add this as a workbook module from which you call your sub

Private Sub Workbook_SheetFollowHyperlink(ByVal Sh As Object, ByVal Target
As Hyperlink)
Mysub
End Sub

and your sub

Sub Mysub()
MsgBox "In mysub"
'do lots of things
End Sub

You can do exactly the same from the worksheet 'follow hyperlink event.

Mike


"Daniel Bonallack" wrote:

Following on from my last post, what I would really like is
- to have a hyperlink-type text in a cell, so that when you mouse over it,
it becomes a hand icon
- but instead of linking this to a file or webpage, I want it to run a maco.

Is this possible?

Thanks
Daniel

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Hyperlink to code

Danial,

I messed up on the event code you need this to prevent any hyperlink calling
your code

Private Sub Workbook_SheetFollowHyperlink(ByVal Sh As Object, ByVal Target
As Hyperlink)
If Target.Range.Address = "$A$1" Then
Mysub
Exit Sub
End If
End Sub

Mike

"Mike H" wrote:

Daniel,


Put some text in a cell (This uses A1) and then
Insert|Hyperlink
for the address put the cell the 'hyperlink is in i.e it goes nowhere a
circular hyperlink.

The add this as a workbook module from which you call your sub

Private Sub Workbook_SheetFollowHyperlink(ByVal Sh As Object, ByVal Target
As Hyperlink)
Mysub
End Sub

and your sub

Sub Mysub()
MsgBox "In mysub"
'do lots of things
End Sub

You can do exactly the same from the worksheet 'follow hyperlink event.

Mike


"Daniel Bonallack" wrote:

Following on from my last post, what I would really like is
- to have a hyperlink-type text in a cell, so that when you mouse over it,
it becomes a hand icon
- but instead of linking this to a file or webpage, I want it to run a maco.

Is this possible?

Thanks
Daniel

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Hyperlink to code

Select a cell for the hyperlink.

InsertHyperlinkPlace in this document.

Point to the sheet and cell you have selected and OK

Right-click on the sheet tab and "View Code".

Paste this event code into the module.

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
macroname
End Sub


Gord Dibben MS Excel MVP

On Mon, 6 Oct 2008 10:19:01 -0700, Daniel Bonallack
wrote:

Following on from my last post, what I would really like is
- to have a hyperlink-type text in a cell, so that when you mouse over it,
it becomes a hand icon
- but instead of linking this to a file or webpage, I want it to run a maco.

Is this possible?

Thanks
Daniel


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
Drop Down/List w/Code and Definition, only code entered when selec Spiritdancer Excel Worksheet Functions 2 November 2nd 07 03:57 AM
formula or code to extract hyperlink from displayed text CT3or4 Excel Discussion (Misc queries) 9 May 17th 07 10:51 PM
Can't make hyperlink function work for hyperlink to website Frank B Denman Excel Worksheet Functions 15 February 5th 07 11:01 PM
Intra-workbook hyperlink: macro/function to return to hyperlink ce marika1981 Excel Discussion (Misc queries) 3 May 6th 05 05:47 AM
edit hyperlink code cont from 12/8/04 doug Excel Discussion (Misc queries) 4 December 17th 04 11:51 PM


All times are GMT +1. The time now is 09:45 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"