PDA

View Full Version : problem with running event-based macro



flowergirl
08-26-2011, 11:44 PM
Hi,

I have written an event-based macro(WorkSheet_BeforeDoubleclick). While I try to run it the list of modules come up but the event-based macro is not in the list.

How do I run this macro?

Thanks for your help.

GTO
08-27-2011, 12:58 AM
Hi there,

Event procedures will not show in the macro dialog box, as they are Private. BeforeDoubleClick will also not show because it has parameters.

If you are trying to watch it work, with the cursor in the declaration line, press the F9 key to enter a breakpoint.

Or, you could put a Stop in the code, like:
Option Explicit

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

Stop
' Your code...
End Sub
This will cause the code to break as soon as you double-click a cell; and you can then press the F8 key (repeatedly) to execute the code line-by-line.

Hope that helps,

Mark