MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

first text box on user form to be selected

  Asked By: Jaxson    Date: Feb 03    Category: MS Office    Views: 1039

In a user form, when it's opened, I want the first text box to be
selected, so that the user can change it without clicking it.
The cursor is inside at the end of my default text. If I tab through
the form, the contents of text boxes get selected.
Just not when the form pops up.



1 Answer Found

Answer #1    Answered By: Dixie Jacobs     Answered On: Feb 03

Double click on your user  form itself...and enter this code...

Private Sub UserForm_Activate()
With TextBox1 '<----change to your textbox name
.SelStart = 0
.SelLength = Len(.Text)
End With
End Sub

Just be sure to change  the name to your textbox name.

Didn't find what you were looking for? Find more on first text box on user form to be selected Or get search suggestion and latest updates.