PDA

View Full Version : [SOLVED] dblclick cell text cursor blinking



Juraj
01-08-2018, 11:03 AM
Hi, guys,

can anyone help me with this problem, please?

I have cell with value of string type. I programmed a "Public Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)" procedure to show UserForm after doubleclick on some cell - let it is "B3" cell. The UserForms is showed after doubleclick but there is blinking text cursor somewhere in middle of string of the doubleclicked "B3" cell. As a result I can't work with UsetForm buttons until I click to any other cell because blinking "B3" cursor locks it. After this click the "B3" unlocks and I can continue in my work.

My question: How can I in VBA clear the blinking text cursor in the active cell? I want to save the "B3" selection. It means the same situation like after single click on some other cell and then single click on the "B3" cell again.

Thanks a lot

Juraj
Praha, Czech republic

Logit
01-08-2018, 02:39 PM
.
This macro will setfocus to one of the command buttons on your userform, which should make the blinking cursor disappear when the form is loaded.



Option Explicit

Private Sub UserForm_Initialize()
CommandButton2.SetFocus
End Sub



And this macro, also paste in the UserForm module, will setfocus to cell A1 when the Userform is closed :




Private Sub UserForm_Terminate()
Range("A1").Select
End Sub


Of course, you can edit the commandbutton selection and the cell selection as required.

SamT
01-08-2018, 04:44 PM
How can I in VBA clear the blinking text cursor
Set Cancel = True in the BeforeDoubleClick sub

I doubt it, but you might have Select another cell in the same sub

Cancel = True
Range("A1").Select 'Might be useful
USerForm1.Show

Juraj
01-08-2018, 06:26 PM
Thanks! Cancel = True in the BeforeDoubleClick sub is exactly what I needed :-)