ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hyperlink events (https://www.excelbanter.com/excel-programming/439363-hyperlink-events.html)

ZipCurs

Hyperlink events
 
I am trying to do what I assume would be simple. I want to initiate some
code when a hyperlink is clicked. I have put to following code in Sheet1,
which has the hyperlink(s).

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Sheets("Sheet1").Range("B1") = "It Ran"
End Sub

The hyperlink runs, but never runs the code. I am running Excel 2007.

Barb Reinhardt

Hyperlink events
 
In the immediate window type this and try again
APplication.EnableEvents = True
--
HTH,

Barb Reinhardt



"ZipCurs" wrote:

I am trying to do what I assume would be simple. I want to initiate some
code when a hyperlink is clicked. I have put to following code in Sheet1,
which has the hyperlink(s).

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Sheets("Sheet1").Range("B1") = "It Ran"
End Sub

The hyperlink runs, but never runs the code. I am running Excel 2007.


ZipCurs

Hyperlink events
 
Hello Barb,

Thank you for the quick response. I definitely have the events enabled. I
substituted the following code and it worked fine:

Sub Worksheet_SelectionChange(ByVal Target As Range)
If ActiveCell.Address = "$B$12" Then
Sheets("Sheet1").Range("B1") = "It Ran"
End If
End Sub

The problem seems to be linked to the HyperLink event, which does not run.
Any clues? I eventually plan on putting the code into a workbook with plenty
of other events, so I would prefer to keep the response focused on HyperLink
activation.

"Barb Reinhardt" wrote:

In the immediate window type this and try again
APplication.EnableEvents = True
--
HTH,

Barb Reinhardt



"ZipCurs" wrote:

I am trying to do what I assume would be simple. I want to initiate some
code when a hyperlink is clicked. I have put to following code in Sheet1,
which has the hyperlink(s).

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Sheets("Sheet1").Range("B1") = "It Ran"
End Sub

The hyperlink runs, but never runs the code. I am running Excel 2007.



All times are GMT +1. The time now is 03:12 AM.

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