ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Execute Macros through Hyperlinks. (https://www.excelbanter.com/excel-programming/350685-execute-macros-through-hyperlinks.html)

[email protected]

Execute Macros through Hyperlinks.
 
could anybody help my in this regard? I need to execute Macros by using
simple text links (hyperlinks). I can run macros through images or form
objects, but now the problem is bit different. I dont even have an idea
how to run macros through hyperlinks. please guys help me out in this
regard, it is very urgent for me. thanks and regards,

Saddat Sarfraz
(Saadi)


Tim Williams

Execute Macros through Hyperlinks.
 
Create hyperlinks which just point to the same cell the hyperlink is in.
Handle the sheet's FollowHyperlink event to dtermine which link was clicked.

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)

Select Case Target.Address 'or some other property
Case "D8": MsgBox "call a macro"
Case "D9": MsgBox "call a different macro"
End Select

End Sub

....replace the Msgbox with calls to the appropriate macro.

Tim


--
Tim Williams
Palo Alto, CA


wrote in message
oups.com...
could anybody help my in this regard? I need to execute Macros by using
simple text links (hyperlinks). I can run macros through images or form
objects, but now the problem is bit different. I dont even have an idea
how to run macros through hyperlinks. please guys help me out in this
regard, it is very urgent for me. thanks and regards,

Saddat Sarfraz
(Saadi)




[email protected]

Execute Macros through Hyperlinks.
 
thanks Tim for your reply,

could you also help me out and tell me how do I call the Macro. may I
just need to wrtie the name of the macro in place of MsgBox function.

thanks,

Saddat Sarfraz
(Saadi)


Tim Williams

Execute Macros through Hyperlinks.
 
may I just need to wrtie the name of the macro in place of MsgBox function.
Yes - that's all you need to do
....
Case "whatever": MacroName
....

Tim
--
Tim Williams
Palo Alto, CA


wrote in message
ups.com...
thanks Tim for your reply,

could you also help me out and tell me how do I call the Macro.
thanks,

Saddat Sarfraz
(Saadi)




[email protected]

Execute Macros through Hyperlinks.
 
Sorry to trouble you again.

I am trying to run the command but nothing is happaning. I tried with
Macro as well as MsgBox Function, nothing is working.


Tim Williams

Execute Macros through Hyperlinks.
 
Show the exact code which is not working.
What does it do instead of working?

tim

--
Tim Williams
Palo Alto, CA


wrote in message
oups.com...
Sorry to trouble you again.

I am trying to run the command but nothing is happaning. I tried with
Macro as well as MsgBox Function, nothing is working.




Toppers

Execute Macros through Hyperlinks.
 
Hi,
This worked:

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)

Select Case ActiveCell.Address

Case "$D$8": MyMacro
Case "$D$9": MsgBox "call a different macro"

End Select

End Sub

Sub MyMacro()
MsgBox "MyMacro called"
End Sub


HTH

" wrote:

Sorry to trouble you again.

I am trying to run the command but nothing is happaning. I tried with
Macro as well as MsgBox Function, nothing is working.




All times are GMT +1. The time now is 10:46 PM.

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