Launching a Macro bt Double Clicking

J

jswalsh33

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
 
A

Ayo

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
 
M

Mike H

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
 
J

jswalsh33

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top