Consulting

Results 1 to 4 of 4

Thread: dblclick cell text cursor blinking

  1. #1
    VBAX Regular
    Joined
    Jul 2017
    Posts
    6
    Location

    dblclick cell text cursor blinking

    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

  2. #2
    VBAX Expert Logit's Avatar
    Joined
    Sep 2016
    Posts
    613
    Location
    .
    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.

  3. #3
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    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
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  4. #4
    VBAX Regular
    Joined
    Jul 2017
    Posts
    6
    Location
    Thanks! Cancel = True in the BeforeDoubleClick sub is exactly what I needed :-)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •