ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Hyperlink to a Macro (https://www.excelbanter.com/excel-discussion-misc-queries/152902-hyperlink-macro.html)

pokdbz

Hyperlink to a Macro
 
Can you make a Hyperlink so when you click it runs a macro?

Jim Cone

Hyperlink to a Macro
 
Yes

"pokdbz"
wrote in message
Can you make a Hyperlink so when you click it runs a macro?

Gary''s Student

Hyperlink to a Macro
 
First have the hyperlink point to a cell. When the jump is made to the cell,
use an Event to trigger the macro:

In A1 enter:

=HYPERLINK("#sheet1!Z100","leap")

and in worksheet code have something like:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Intersect(Target, Range("Z100")) Is Nothing Then
Exit Sub
End If
MsgBox ("hello")
End Sub

REMEMBER: worksheet code, not a standard module.
--
Gary''s Student - gsnu200735


"pokdbz" wrote:

Can you make a Hyperlink so when you click it runs a macro?


Dave Peterson

Hyperlink to a Macro
 
If you're using insert|Hyperlink to create those hyperlinks, you may be able to
tie into the Worksheet_FollowHyperlink event.

pokdbz wrote:

Can you make a Hyperlink so when you click it runs a macro?


--

Dave Peterson

Rick

Hyperlink to a Macro
 
How?

"Jim Cone" wrote:

Yes

"pokdbz"
wrote in message
Can you make a Hyperlink so when you click it runs a macro?



All times are GMT +1. The time now is 02:00 AM.

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