chrisjones
08-02-2010, 08:28 AM
I have a made a custom class called "EventRange" which contains a range, when that range is doubleclicked I would like to be able to respond to that event. I have attached what I have done so far, however every time I double click on cell A1 nothing happens.
This is the test sub
Public Sub testEventsClass()
Dim e As EventRange
Set e = New EventRange
Dim r As Range
Set r = Range("A1")
Set e.Range = r
End Sub
This is the EventRange Class
Private WithEvents mwksWorkSheet As Excel.Worksheet
Private r As Range
Public Property Set Range(ByVal value As Range)
Set r = value
End Property
Public Property Get Range() As Range
Set Range = r
End Property
Private Sub mwksWorkSheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Debug.Print "Range " & Target.Address & " has been double clicked"
End Sub
Thanks
Chris
This is the test sub
Public Sub testEventsClass()
Dim e As EventRange
Set e = New EventRange
Dim r As Range
Set r = Range("A1")
Set e.Range = r
End Sub
This is the EventRange Class
Private WithEvents mwksWorkSheet As Excel.Worksheet
Private r As Range
Public Property Set Range(ByVal value As Range)
Set r = value
End Property
Public Property Get Range() As Range
Set Range = r
End Property
Private Sub mwksWorkSheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Debug.Print "Range " & Target.Address & " has been double clicked"
End Sub
Thanks
Chris