Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
aca aca is offline
external usenet poster
 
Posts: 1
Default Launching a macro by double-clicking on active cell


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Launching a macro by double-clicking on active cell

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Launching a macro by double-clicking on active cell


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default Launching a macro by double-clicking on active cell

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Launching a macro by double-clicking on active cell


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Launching a macro by double-clicking on active cell


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
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 in Cell-- unwanted move KIM W Excel Discussion (Misc queries) 5 June 25th 08 06:57 PM
Buttons that appear when double clicking in a cell Leopold Excel Worksheet Functions 1 April 25th 07 08:38 PM
Cell double-clicking problem vbMark Excel Discussion (Misc queries) 4 August 30th 06 08:09 PM
How can I create a chart when double clicking a cell? porl99 Excel Worksheet Functions 1 April 12th 05 05:19 PM
double clicking on a source cell martin Excel Worksheet Functions 1 February 8th 05 02:09 AM


All times are GMT +1. The time now is 11:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"