Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here's what doesn't work. How do I correct It so both macros work on
different ranges? The error message I get is: Ambiguous name detected They both work independently but not on the same project. Option Explicit Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Application.EnableEvents = False On Error GoTo sub_exit If Not Intersect(Target, Range("c7:c57")) Is Nothing Then With Target If .Value = "X" Then .Value = "" Else .Value = "X" End If End With Cancel = True End If sub_exit: Application.EnableEvents = True End Sub Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Dim Rng1 As Range 'Assign the range to work with Set Rng1 = Range("D7:D57") 'Only work on assigned range If Intersect(Target, Rng1) Is Nothing Then Exit Sub 'Cancel cell editing that would normally trigger when you double click Cancel = True 'Call the userform UserForm1.Show End Sub "jack" wrote in message ... Can someone help me on how I can set up two different double click macros (two different resulting actions) on the same worksheet for different ranges. I have each macro starting with: Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean). I found very quickly that it doesn't work. What do I need to do so that each will work independently? Any basic direction would be appreciated. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
double click macros | Excel Programming | |||
double click macros | Excel Programming | |||
double click macros | Excel Programming | |||
Click on graph bar to execute a double-click in a pivot table cell | Charts and Charting in Excel | |||
Mouse Over Graph, Capture Information on Click(Double Click) | Excel Programming |