Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() How can I make my macro to be executed when the user double-clicks on the active cell of Excel? Thanks for any help. aca -- aca ------------------------------------------------------------------------ aca's Profile: http://www.excelforum.com/member.php...o&userid=25933 View this thread: http://www.excelforum.com/showthread...hreadid=393051 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On the sheet tab you want to react to the double click, right click the tab
and select veiw code. This will take you to the VBE. Paste this code in and you are off and running... Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Cancel = True MsgBox Target.Address End Sub -- HTH... Jim Thomlinson "aca" wrote: How can I make my macro to be executed when the user double-clicks on the active cell of Excel? Thanks for any help. aca -- aca ------------------------------------------------------------------------ aca's Profile: http://www.excelforum.com/member.php...o&userid=25933 View this thread: http://www.excelforum.com/showthread...hreadid=393051 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thank you for your quick response. I'm going to try it, though I'am a very, very beginner and I may not b able to do steps that are obvious for you, programmers. But that is no less merit on your part. God bless you. aca Jim Thomlinson Wrote: On the sheet tab you want to react to the double click, right click th tab and select veiw code. This will take you to the VBE. Paste this code i and you are off and running... Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cance As Boolean) Cancel = True MsgBox Target.Address End Sub -- HTH... Jim Thomlinson "aca" wrote: How can I make my macro to be executed when the user double-click on the active cell of Excel? Thanks for any help. aca -- aca ------------------------------------------------------------------------ aca's Profile http://www.excelforum.com/member.php...o&userid=25933 View this thread http://www.excelforum.com/showthread...hreadid=393051 -- ac ----------------------------------------------------------------------- aca's Profile: http://www.excelforum.com/member.php...fo&userid=2593 View this thread: http://www.excelforum.com/showthread.php?threadid=39305 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
use the sheet's 'before doubleclick event'
to get to the sheet's code page, right click while pointing at the sheet's tab, then select 'View Code' add this: Option Explicit Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Target.Value = "GO" Then Cancel = True Call MyProcedure End If End Sub Sub MyProcedure() MsgBox "done" End Sub If the cell contains the word GO then the procedure is called. This alternative runs a procedure whose name is in the cell that is double-clicked. Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Target.Value < "" Then On Error Resume Next Run Target.Value Cancel = Err.Number = 0 End If End Sub In this case the procedure must be public and in a standard module. There's an error trap, so if a sub exists it runs, if not, the double click event continues. HTH "aca" wrote in message ... How can I make my macro to be executed when the user double-clicks on the active cell of Excel? Thanks for any help. aca -- aca ------------------------------------------------------------------------ aca's Profile: http://www.excelforum.com/member.php...o&userid=25933 View this thread: http://www.excelforum.com/showthread...hreadid=393051 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thank you for your quick response. I'm going to try it, though I'am a very, very beginner and I may not be able to do steps that are obvious for you, programmers. But that is no less merit on your part. God bless you. aca Patrick Molloy Wrote: use the sheet's 'before doubleclick event' to get to the sheet's code page, right click while pointing at the sheet's tab, then select 'View Code' add this: Option Explicit Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Target.Value = "GO" Then Cancel = True Call MyProcedure End If End Sub Sub MyProcedure() MsgBox "done" End Sub If the cell contains the word GO then the procedure is called. This alternative runs a procedure whose name is in the cell that is double-clicked. Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) If Target.Value < "" Then On Error Resume Next Run Target.Value Cancel = Err.Number = 0 End If End Sub In this case the procedure must be public and in a standard module. There's an error trap, so if a sub exists it runs, if not, the double click event continues. HTH "aca" wrote in message ... How can I make my macro to be executed when the user double-clicks on the active cell of Excel? Thanks for any help. aca -- aca ------------------------------------------------------------------------ aca's Profile: http://www.excelforum.com/member.php...o&userid=25933 View this thread: http://www.excelforum.com/showthread...hreadid=393051 -- aca ------------------------------------------------------------------------ aca's Profile: http://www.excelforum.com/member.php...o&userid=25933 View this thread: http://www.excelforum.com/showthread...hreadid=393051 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() aca, When you go into the VBA Edit window for your worksheet module. Click on the left slot and choose "Worksheet" Then click on the right slot and you wil have some selections. Choose this one: Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) This help? Dave aca Wrote: How can I make my macro to be executed when the user double-clicks on the active cell of Excel? Thanks for any help. aca -- Piranha ------------------------------------------------------------------------ Piranha's Profile: http://www.excelforum.com/member.php...o&userid=20435 View this thread: http://www.excelforum.com/showthread...hreadid=393051 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Double Clicking in Cell-- unwanted move | Excel Discussion (Misc queries) | |||
Buttons that appear when double clicking in a cell | Excel Worksheet Functions | |||
Cell double-clicking problem | Excel Discussion (Misc queries) | |||
How can I create a chart when double clicking a cell? | Excel Worksheet Functions | |||
double clicking on a source cell | Excel Worksheet Functions |