Cell Focus When Opening A User Form

  • i would like to retain the focus of the current cell before the user clicks on a button to run a macro (see below) to open a userform...?


    Code
    userform.show


    (the cell focus seems to disapper...after the button is clicked, but does stay on the cell when i run the macro from tools macros...)


    ???


    thank you...

  • Re: Cell Focus When Opening A User Form


    I think a modal form always has the focus. You'd have to do


    Code
    userform.show vbmodeless

    [SIZE=1]Entia non sunt multiplicanda sine necessitate.[/SIZE]

  • Re: Cell Focus When Opening A User Form


    thank you...but,


    i changed to:

    Code
    userform.show vbmodeless


    and i still lose the focus on the current cell (and i tried at the form's property to change showmode to true and then false)...


    ???


    thank you.

  • Re: Cell Focus When Opening A User Form


    Now I think I see what you mean, and I've wasted your time. You mean have the focus, as in if you start typing, the entry goes into the cell, correct?


    When the form opens the activewindow remains the workbook (I thought it would change to the form, and could be set back to the workbook). So the answer is, I have no idea ... But someone else here may.

    [SIZE=1]Entia non sunt multiplicanda sine necessitate.[/SIZE]

  • Re: Cell Focus When Opening A User Form


    Can you post the code that needs the focus on the active cell?


    As far as I'm aware showing a userform just doesn't change that focus.:confused:

    Boo!:yikes:

  • Re: Cell Focus When Opening A User Form


    thanks...


    i put the cursor in a cell, when i run the macro from the macro toolbar, the focus stays in the cell, but when i use my mouse to click on a button that runs the macro, i seemingly lose the focus of the cell (i don't know where it goes...but when i hit "tab", the cursor is on a textbox on the userform...


    Code
    userform.show 'open user form


    (and then the user form gets info. from the active worksheet...)


    thank you...!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!