ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   On Click Event in Excel (https://www.excelbanter.com/excel-programming/379288-click-event-excel.html)

ISUTri

On Click Event in Excel
 
Is there anyway I can have Excel run code on a single click in a cell?
What I'm trying to do is I have a spreadsheet that has hyperlinks in
it. However, I want it to run code when someone clicks on the
hyperlink before it sends the user on to the hyperlink. I've found
where I can do this with a double click but that doesn't do me any good
since the hyperlink only requires one click.

Thanks for any help


Bob Phillips

On Click Event in Excel
 
Use the FollowHyperlink event


Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
'your code
End Sub


'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"ISUTri" wrote in message
ps.com...
Is there anyway I can have Excel run code on a single click in a cell?
What I'm trying to do is I have a spreadsheet that has hyperlinks in
it. However, I want it to run code when someone clicks on the
hyperlink before it sends the user on to the hyperlink. I've found
where I can do this with a double click but that doesn't do me any good
since the hyperlink only requires one click.

Thanks for any help





All times are GMT +1. The time now is 01:50 PM.

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