I’d like to display a dialog after a user clicks a cell in an Excel sheet.
Something like this:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
MsgBox "a cell was clicked!", vbOKOnly, "a click"
End Sub
It works perfectly fine. The problem is, after a double click edit mode is turned on and a formula is expected to be entered. How do I disable this behaviour?
I’d like to achieve pure functionality:
~ user clicks a cell
~ a dialog appears
~ user closes the dialog
~ a cell does NOT go into edit mode, the sheet looks exactly as it did before double click event.
You have to cancel the action with the variable given in argument:
Here is a dummy example:
Note that you wouldn’t have to set
CanceltoFalsebecause it the default value (this is for the example purpose).