Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default how to run macro in double click on a particular cell

How to run macro in double click on a particular cell?

let me know, how we can run a macro when i am pressing double click on
particular cell.

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default how to run macro in double click on a particular cell

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Intersect(Target, Range("B9")) Is Nothing Then
Else
MsgBox ("Hello Khizhavan")
End If
End Sub


Because it is worksheet code, it is very easy to install and automatic to use:

1. right-click the tab name near the bottom of the Excel window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you have any concerns, first try it on a trial worksheet.

If you save the workbook, the macro will be saved with it.


To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm

--
Gary''s Student - gsnu200799


"Khizhavan" wrote:

How to run macro in double click on a particular cell?

let me know, how we can run a macro when i am pressing double click on
particular cell.

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default how to run macro in double click on a particular cell

Gary - can you help me further - this is exactly what I need but it is not
working for me.
I created a new sheet in my workbook and did the view code thing by right
clicking on the sheet name

I pasted the following in (I have just copied it out of it here to be ceratin)

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Intersect(Target, Range("B9")) Is Nothing Then
Else
MsgBox ("Hello Khizhavan")
End If
End Sub


I assume that if I double click cell B9 on that sheet the Msgbox should
display but it doesn't

I must be missing something?



"Gary''s Student" wrote:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Intersect(Target, Range("B9")) Is Nothing Then
Else
MsgBox ("Hello Khizhavan")
End If
End Sub


Because it is worksheet code, it is very easy to install and automatic to use:

1. right-click the tab name near the bottom of the Excel window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you have any concerns, first try it on a trial worksheet.

If you save the workbook, the macro will be saved with it.


To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm

--
Gary''s Student - gsnu200799


"Khizhavan" wrote:

How to run macro in double click on a particular cell?

let me know, how we can run a macro when i am pressing double click on
particular cell.

Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default how to run macro in double click on a particular cell

ignore that.
I tried again and it worked - go figure!

"Gary''s Student" wrote:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Intersect(Target, Range("B9")) Is Nothing Then
Else
MsgBox ("Hello Khizhavan")
End If
End Sub


Because it is worksheet code, it is very easy to install and automatic to use:

1. right-click the tab name near the bottom of the Excel window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you have any concerns, first try it on a trial worksheet.

If you save the workbook, the macro will be saved with it.


To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm

--
Gary''s Student - gsnu200799


"Khizhavan" wrote:

How to run macro in double click on a particular cell?

let me know, how we can run a macro when i am pressing double click on
particular cell.

Thanks

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default how to run macro in double click on a particular cell

could have been a one liner

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Not Intersect(Target, Range("B9")) Is Nothing Then MsgBox "Hello"

'or using absolutes and UPPER case
'if target.address="$B$9" then msgbox "hello"
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"RocketRod" wrote in message
...
ignore that.
I tried again and it worked - go figure!

"Gary''s Student" wrote:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Intersect(Target, Range("B9")) Is Nothing Then
Else
MsgBox ("Hello Khizhavan")
End If
End Sub


Because it is worksheet code, it is very easy to install and automatic to
use:

1. right-click the tab name near the bottom of the Excel window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you have any concerns, first try it on a trial worksheet.

If you save the workbook, the macro will be saved with it.


To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm

--
Gary''s Student - gsnu200799


"Khizhavan" wrote:

How to run macro in double click on a particular cell?

let me know, how we can run a macro when i am pressing double click on
particular cell.

Thanks


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 click cell to execute macro JDaywalt Excel Programming 12 August 15th 07 02:47 PM
Double-click to run macro? JAnderson Excel Discussion (Misc queries) 6 February 8th 07 10:01 PM
Run macro on double click only famdamly Excel Discussion (Misc queries) 2 February 27th 06 12:15 PM
How to call a sub defined in macro when double click a cell? Ivan Excel Programming 3 November 20th 05 09:46 PM
Click on graph bar to execute a double-click in a pivot table cell [email protected] Charts and Charting in Excel 4 August 3rd 05 01:37 AM


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