Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WorkSheet_DoubleClick NOT BeforeDoubleClick event? 2

Status
Not open for further replies.

MatthewBell

Technical User
Feb 12, 2003
26
GB
Hi Everyone

I'm looking to run some code following a double click (or right click) on a worksheet. Thing is I don't want to run it 'Before' the normal double click event handler. I want to run it 'instead'. Is there a way of doing this eg, by writing some code in the BeforeDoubleClick Event handler to stop the normal thing happenening after the code i've written is exectuted.

At present i'm having to use selection change which means the code runs more often than I want which is a pain. I already have if statements to try and curb its excessive running but its not really good enough.

If disabling the normal doubleclick event on the range in question is not possible it would be nearly as good if I could 'Assign' a macro to a range of cells so that a click on the cells (as opposed to a selection change) would run the code.

Is this possible or am I asking too much?

Thanks

Matt [sadeyes]
 
Matt,

If you set Cancel = True inside the BeforeDoubleClick event procedure, it prevents the normal double-click event from taking place. Include the code you want to run instead.


HTH
Mike
 
Cheers Mike

Short, sweet and helpful with more than just this problem.

Just how I like them.

I also couldn't get anything resembling help from the help files on this so a star is in order.

Matt [thumbsup2]
 
Thanks, Matt. It's appreciated.

As for help on this topic, the best approach is to use the Object Browser in the VBE, selecting the object you are interested in. In this case, look up the Worksheet object. In the right-hand pane, select the BeforeDoubleClick event, right-click and choose Help.


Regards,
Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top