Stop Cell Edit when DoubleClick

D

David McRitchie

When I double-click on a cell it puts the cell into
"Edit mode". How do I turn this off. True whether
there is a double-click Event macro or not. My concern
is when a macro is involved, having the cell in Edit mode
messes up things including working in the VBE while
in cell edit.

Shows up more obviously if cell content is like
'AAA because then you will see the single quote
within the cell and the cursor after the last character.

Tools, Options, Edit, Edit Directly in a Cell
is invoked and it will stay that way.
Just want the macro to not leave it in Edit mode.

Test without and with a macro:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
MsgBox "do nothing"
End Sub

The following will circumvent, but there must be a better way

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
MsgBox "do nothing"
Application.SendKeys "{Down}"
Application.SendKeys "{up}"
End Sub

And if "edit mode" is not the correct terminology
please correct. Might be obvious from the solution though.
 
D

David McRitchie

Thanks Norman,
Keep forgetting that, and the confusing part to me
is that it applies to disable the right-click menu
and to turning off cell edit.

But I guess they really are the same, because
that's why they are called context menus.

It will be added it at top to my event.htm so "I'll remember".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top