View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Franz Verga Franz Verga is offline
external usenet poster
 
Posts: 459
Default Visual Basic - active macro on cell click

Brettjg wrote:
This must be really obvious but I cannot find this anywhere in HELP.
I want to set up the worksheet so that if a cell is double clicked by
the user then a particular macro will run automatically



Hi Brettjg,

Right click the sheet tab you want this behaviour, select View Code and copy
& past this code:


Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Not Intersect(Target, "A1") Is Nothing Then Call MyMacro
End Sub

change A1 with your target cell or range and MyMacro with the name of your
macro.

--
Hope I helped you.

Thanks in advance for your feedback.

Ciao

Franz Verga from Italy