Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Textbox behaviour

Status
Not open for further replies.

Karja

Programmer
Apr 20, 2006
43
LU
Goodmorning,

I am using a form in a small Excel application that uses default values.

Now I am searching for a way that when the user actually enters te field by the tab or just by clicking the field the whole text is selected. So that you're not modifiying the text but in fact replacing it?

Does anyone have a smart idea to achieve this?

Kind regards,
 
Have a look at the SelStart, SelLength & SelText properties of the textbox for this

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Yes, Thanks a lot! It works. I used this on the enter event:

Code:
Private Sub txtProject_Enter()
    Me.txtProject.SelStart = 0
    Me.txtProject.SelLength = Len(Me.txtProject.Text)
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top