Answers for "excel formula hyperlink run a VBA macro"

VBA
22

excel formula hyperlink run a VBA macro

'Execute VBA code from hyperlink on a worksheet that is the result 
'of the HYPERLINK() worksheet function.

'Insert the following function in a standard code module:


Function HyperlinkClick()

    Set HyperlinkClick = Selection
    
    'Do whatever you like here...
    MsgBox "You clicked on cell " & Selection.Address(0, 0)

End Function


'-------------------------------------------------------------------------------

'Now in a worksheet cell, enter the followin formula:

=HYPERLINK("#HyperlinkClick()", "Text you want to Display")


'Clicking on that hyperlink will run the VBA function above.

'Notice the (#) symbol as the first character of the link_location 
'parameter. This is required for the function to work properly.
'
'
'
Posted by: Guest on March-02-2021

Code answers related to "VBA"

Browse Popular Code Answers by Language