View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Highlighting Textbox

Garry,

If you want to highlight (select) the text in a textbox, use the SelStart
and SelLength properties. E.g.,

With Userform1.TextBox1
.SelStart = 0
.SelLength = Len(.Text)
.SetFocus
End With


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com

"Garry Jones" wrote in message
...
I have a userform with a Textbox that starts off with an initial value
read in from a cell.

After taking the user to the textbox I want the value withing it to be
highlighted.

This code does not solve it..

_______________________________________

Private Sub UserForm_Initialize()
TextBox1.Text = Worksheets("blad1").Cells(5, 1)
TextBox1.SetFocus
End Sub
_______________________________________

Any ideas?

Garry Jones