Reputation: 409
Is there a way to deselect a cell with Excel VBA? My situation is I have a worksheet double-click event, so the cell must be selected for the macro to run. But that leaves a flashing cursor in the cell that's selected.
How do I deselect the cell once the macro is done? I've searched Google for a few methods and tried some, but none quite work properly. I've tried moving the selection left one cell and then right, back to the original cell. But for some reason, the cursor is still flashing in the selected cell. Any help?
Upvotes: 1
Views: 8048
Reputation: 26650
The Worksheet_BeforeDoubleClick
event has an argument called Cancel
. Have a line in your double click event code that sets Cancel = True
and that will cancel the cell edit mode and just have the cell selected instead of the blinking cursor within the cell
Upvotes: 8