![]() |
Launching a Macro bt Double Clicking
I would like to launch an Excel macro by double clicking on a cell in an
Excel worksheet. I used one of your answers to a similar question and wrote the following code in the "View Code" area of the worksheet. Private Sub Woorksheet_BeforeDoubleClick_(ByVal Target As Range, Cancel As Boolean) If Target.Address = "$E$5" Then Call Find2 End If End Sub If I then click on Cell E5 on the worksheet nothing happens. What am I doing wrong? I am running Windows XP, Excel OFFXL7 |
Launching a Macro bt Double Clicking
Try:
Private Sub Woorksheet_BeforeDoubleClick_(ByVal Target As Range, Cancel As Boolean) If Target.Address = "$E$5" Then Cancel = True Call Find2 End If End Sub "jswalsh33" wrote: I would like to launch an Excel macro by double clicking on a cell in an Excel worksheet. I used one of your answers to a similar question and wrote the following code in the "View Code" area of the worksheet. Private Sub Woorksheet_BeforeDoubleClick_(ByVal Target As Range, Cancel As Boolean) If Target.Address = "$E$5" Then Call Find2 End If End Sub If I then click on Cell E5 on the worksheet nothing happens. What am I doing wrong? I am running Windows XP, Excel OFFXL7 |
Launching a Macro bt Double Clicking
Hi,
There's nothing wrong with the code and you have it in the correct place so a couple of possibilities:- Do you have macros disabled i.e. did you eanble them when you opened this workbook. have you accidently disabled events? Put this sub into your workbook and run it Sub aaa() Application.EnableEvents = True End Sub The code will only work on the sheet where you inserted the code and not all sheets. Are you double clicking E5 in the correct sheet? Mike "jswalsh33" wrote: I would like to launch an Excel macro by double clicking on a cell in an Excel worksheet. I used one of your answers to a similar question and wrote the following code in the "View Code" area of the worksheet. Private Sub Woorksheet_BeforeDoubleClick_(ByVal Target As Range, Cancel As Boolean) If Target.Address = "$E$5" Then Call Find2 End If End Sub If I then click on Cell E5 on the worksheet nothing happens. What am I doing wrong? I am running Windows XP, Excel OFFXL7 |
Launching a Macro bt Double Clicking
I tried both of these suggestions and got the same results. The macro is not
launched. What does happen is the cell (E5) is selected with the cursor in the cell. Cell E5 contains data that is used by the macro to search for a name on another worksheet. "Mike H" wrote: Hi, There's nothing wrong with the code and you have it in the correct place so a couple of possibilities:- Do you have macros disabled i.e. did you eanble them when you opened this workbook. have you accidently disabled events? Put this sub into your workbook and run it Sub aaa() Application.EnableEvents = True End Sub The code will only work on the sheet where you inserted the code and not all sheets. Are you double clicking E5 in the correct sheet? Mike "jswalsh33" wrote: I would like to launch an Excel macro by double clicking on a cell in an Excel worksheet. I used one of your answers to a similar question and wrote the following code in the "View Code" area of the worksheet. Private Sub Woorksheet_BeforeDoubleClick_(ByVal Target As Range, Cancel As Boolean) If Target.Address = "$E$5" Then Call Find2 End If End Sub If I then click on Cell E5 on the worksheet nothing happens. What am I doing wrong? I am running Windows XP, Excel OFFXL7 |
All times are GMT +1. The time now is 12:53 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com