View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Rick S. Rick S. is offline
external usenet poster
 
Posts: 213
Default Running code when hyperlink clicked

Can you define what the differences are?
--
Regards

Rick


"Gary''s Student" wrote:

Use an Inserted hyperlink, not the worksheet function.
--
Gary''s Student - gsnu201001


"ZipCurs" wrote:

Hello,

I am definitely baffled. I am trying to run code when a hyperlink is
clicked. I am using Excel 2007, the hyperlink is created in a cell on Sheet
1 using "=hyperlink()", the hyperlink is to a video clip, and events are
definitely enabled. I had tried two things, either of which would be fine:

1. I put the following code in Sheet1, and it did not respond at all. What
am I doing wrong?

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

2. I put the following code in Sheet1, and it does run. The only issue is
that I would like to be able to terminate the hyperlink before the video pops
up. Any thoughts?

Sub Worksheet_SelectionChange(ByVal Target As Range)

If ActiveCell.Column = 2 Then
Sheets("Sheet1").Range("B1") = "It Ran"
'Want to terminate hyperlink here. How to do?
End If

End Sub

Any help in understanding either one of these would be greatly appreciated.
Thank you in advance.