Run a macro from a hyperlink


Posted by Chad on January 17, 2002 9:08 AM

I have a macro that I would like to run when clicking a hyperlink I want to place in a cell. Does anyone know how if this can be done? If not I would like to have the macro run if any cell in a particular column was clicked on. Any help would be appreciated.

Thanks

Posted by Juan Pablo G. on January 17, 2002 9:11 AM

This goes in the Sheet's module. To go there, right click on the Sheet's tab, click View Code, and paste this there.

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Target.Column = 2 Then MyMacro
End Sub

This will run the macro called MyMacro when the user SELECTS any cell in Column B.

Juan Pablo G.

Posted by Chad on January 17, 2002 9:20 AM

Does anyone know if it's possible to click a hyperlink to launch a macro?

Posted by Juan Pablo G. on January 17, 2002 9:22 AM

No, i don't think it's possible.

Juan Pablo G.



Posted by Juan Pablo G. on January 17, 2002 9:23 AM

Meaning you would have to use the SelectChange event (NT)

No, i don't think it's possible. : Does anyone know if it's possible to click a hyperlink to launch a macro? :