Share via

Executing vba code on text box activation (a mouse click into the text box) in a userform

Anonymous
2013-01-03T10:56:04+00:00

I would like to execute some VBA code on clicking the cursor into a textbox on a userform. 

I know it is possible to do when there is a change in a textbox as in Private Sub TextBox2_Change()but this requires a keystroke within the textbox.

If possible, I want to avoid the need for a key stroke and activate the vba code purely on a mouse click into the text box.

I would really appreciate any help to achieve this or confirmation that it is not possible.


Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2013-01-03T11:03:37+00:00

Use the Private Sub TextBox2_Enter()

Was this answer helpful?

5 people found this answer helpful.
0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Anonymous
    2013-01-03T11:13:03+00:00

    Brilliant. Many thanks for your help. Really appreciate it.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2013-01-03T11:08:07+00:00

    Try using an Enter() procedure:

    Private Sub TextBox2_Enter()

    Was this answer helpful?

    0 comments No comments