Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Doube click cell to run macro

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!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Doube click cell to run macro

On 11/08/2010 19:30, Steve H wrote:
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!


Perhaps this would work;

Private Sub Worksheet_BeforeDoubleClick _
(ByVal Target As Range, Cancel As Boolean)
Dim iSect As Range

Set iSect = Application.Intersect(Range("c4, c6"), Target)
If Not iSect Is Nothing Then
MsgBox Target.Address '<<< Your calendar code here
End If
End Sub
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to run a macro upon a cell click Banzai Excel Programming 3 July 26th 07 09:19 PM
Macro on cell click?? Jim Thomlinson[_5_] Excel Programming 0 February 6th 06 09:33 PM
Macro on cell click?? Gary''s Student Excel Programming 0 February 6th 06 09:29 PM
Run Macro on Cell Click.. CliffHanger9 Excel Programming 0 November 17th 04 07:46 PM
Run Macro on Cell Click.. scottymelloty[_12_] Excel Programming 1 November 17th 04 06:15 PM


All times are GMT +1. The time now is 05:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"