Excel text box properties

R

R Ormerod

I have a text box inserted in my worksheet from the Control Toolbox toolbar.

Is there an option which allows me to specify that existing text in the box
is overwritten by new entries (I have the number of possible characters
restricted so this would be very useful). I can't find one in the Properties
window so maybe the only solution is VBA?

Thanks
 
S

squenson via OfficeKB.com

You can have this code when the text box gets the focus:

Private Sub TextBox1_GotFocus()

TextBox1.SelStart = 0
TextBox1.SelLength = Len(TextBox1.Value)

End Sub

(Replace TextBox1 by the name of your textbox, it appears four times)
 
Top