Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Launch Macro By Double Clicking
On May 5th I wrote a question about how to launch an Excel Macro by double
clicking on a cell. I have tried what was suggested, but I still cannot make it work. Any further help would be greatly appreciated. I have the following code in the "View Code" area of the worksheet. Sub aaa() Application.Events = True End Sub Private Sub Worksheet_BeforeDoubleClick_(ByVal Target As Range, Cancel As Boolean) If Target.Address = $E$5 Then Cancel=True Call Find2 End IF End Sub Macros are enabled. When I double click on E5 in the worksheet that I put the code into, nothing happens, except the cell E5 is selected. I have a button on the same sheet that runs Macro Find2 when clicked. I am running Windows XP, Excel OFFXL7 Thank-you Jim Walsh |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Launch Macro By Double Clicking
On May 11, 2:52*pm, jswalsh33
wrote: On May 5th I wrote a question about how to launch an Excel Macro by double clicking on a cell. I have tried what was suggested, but I still cannot make it work. Any further help would be greatly appreciated. I have the following code in the "View Code" area of the worksheet. Sub aaa() Application.Events = True End Sub Private Sub Worksheet_BeforeDoubleClick_(ByVal Target As Range, Cancel As Boolean) If Target.Address = $E$5 Then Cancel=True Call Find2 End IF End Sub Macros are enabled. When I double click on E5 in the worksheet that I put the code into, nothing happens, except the cell E5 is selected. I have a button on the same sheet that runs Macro Find2 when clicked. I am running Windows XP, Excel OFFXL7 Thank-you Jim Walsh Jim, Put your if condition in quotes. instead of $E$5 just write "$E$5" It worked on my machine |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Launch Macro By Double Clicking
Bhupinder Singh gave you a solution (using "$E$5" instead of $E$5), but I like
this syntax better: if intersect(target, me.range("E5")) is nothing then exit sub end if I find it less prone to errors (forgetting $ signs and upper/lower case problems) and it's easier to update when I want to check multiple ranges: if intersect(target, me.range("E5,G10,X1:Z3,IV:IV")) is nothing then exit sub end if jswalsh33 wrote: On May 5th I wrote a question about how to launch an Excel Macro by double clicking on a cell. I have tried what was suggested, but I still cannot make it work. Any further help would be greatly appreciated. I have the following code in the "View Code" area of the worksheet. Sub aaa() Application.Events = True End Sub Private Sub Worksheet_BeforeDoubleClick_(ByVal Target As Range, Cancel As Boolean) If Target.Address = $E$5 Then Cancel=True Call Find2 End IF End Sub Macros are enabled. When I double click on E5 in the worksheet that I put the code into, nothing happens, except the cell E5 is selected. I have a button on the same sheet that runs Macro Find2 when clicked. I am running Windows XP, Excel OFFXL7 Thank-you Jim Walsh -- Dave Peterson |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Launch Macro By Double Clicking
"Bhupinder Singh" wrote: On May 11, 2:52 pm, jswalsh33 wrote: On May 5th I wrote a question about how to launch an Excel Macro by double clicking on a cell. I have tried what was suggested, but I still cannot make it work. Any further help would be greatly appreciated. Actually I had the quotes in my original code, but forgot to put them in my question above. My code doesn't work with the quotes. Any additional help would be greatly appreciated. Jim Walsh I have the following code in the "View Code" area of the worksheet. Sub aaa() Application.Events = True End Sub Private Sub Worksheet_BeforeDoubleClick_(ByVal Target As Range, Cancel As Boolean) If Target.Address = $E$5 Then Cancel=True Call Find2 End IF End Sub Macros are enabled. When I double click on E5 in the worksheet that I put the code into, nothing happens, except the cell E5 is selected. I have a button on the same sheet that runs Macro Find2 when clicked. I am running Windows XP, Excel OFFXL7 Thank-you Jim Walsh Jim, Put your if condition in quotes. instead of $E$5 just write "$E$5" It worked on my machine |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Launching a Macro bt Double Clicking | Excel Programming | |||
Launch an excel hyperlink programatically without clicking | Excel Programming | |||
How can I use VB code to execute macro when double-clicking cell? | Excel Programming | |||
Launching a macro by double-clicking on active cell | Excel Programming | |||
Macro launch - Button vs Manual launch , has different results. | Excel Programming |