Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default 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


  #2   Report Post  
Posted to microsoft.public.excel.programming
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default 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


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
Double Clicking File W. Lock Excel Discussion (Misc queries) 0 November 19th 09 11:56 PM
How can I use VB code to execute macro when double-clicking cell? JDay01 Excel Programming 2 June 13th 06 03:12 PM
Launching a macro by double-clicking on active cell aca Excel Programming 5 August 4th 05 10:08 PM
Double Clicking pnwood New Users to Excel 2 June 24th 05 10:19 PM
Double-clicking entry Gord Dibben Excel Programming 1 February 27th 04 07:31 PM


All times are GMT +1. The time now is 12:33 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"