View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff Harald Staff is offline
external usenet poster
 
Posts: 1,327
Default SetFocus in user form

Private Sub TextBox1_Enter()
With TextBox1
.SelStart = 0
.SelLength = Len(.Text)
End With
End Sub

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"John Tjia" wrote in message
om...
I am creating a user form with a text box that starts with the number
0. I've got the userform_activate to set textbox1.setfocus so that
the cursor is in the text box. However, I find that the cursor is
blinking at the end of the 0, so that the user has to tap to the front
and then go forward to highlight the 0 in order to put in a new
number. How can I set it so that the 0 is highlighted right away, and
the user can input the right number over the 0 immediately?

Many thanks for advice!