Double Click Cell to Run Macro

  • Thread starter Thread starter Steve H
  • Start date Start date
S

Steve H

Hello
This code will open a calendar when any cell is dbl clicked:

Private Sub Worksheet_BeforeDoubleClick _
(ByVal Target As Range, Cancel As Boolean)
OpenCalendar
Cancel = True
End Sub

How can I modify to only run if C4 or C6 is clicked?

Thanks!
 
Sorry Should have been in programming

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)
If Intersect(Target, Union(Range("C4"), Range("C6"))) Is Nothing Then
Exit Sub
OpenCalendar
Cancel = True
End Sub
 
Back
Top