View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default UserForm Control Question

This UserForm Initialize event code should do what you want...

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

--
Rick (MVP - Excel)


"Mark Knutson" wrote in message
...
I have fifteen text boxes in my userform. They have a default value of
zero. When my form loads, the first text box has the focus. I want to
highlight or select the zero so when I enter a number into the text box it
will overwrite the zero rather then put the number after the zero. I can't
figure out the code I need to highlight the zero.

The following text boxes highlight the zero automatically when I press
enter in the previous text boxes. So I just need to be able select the
first text boxes zero. Any help will be appreciated. Thanks in advance. By
the way I have excel 2003. Thanks, Mark