ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Highlight all Text in a Textbox when the textbox is selected (https://www.excelbanter.com/excel-programming/344128-highlight-all-text-textbox-when-textbox-selected.html)

RPIJG[_73_]

Highlight all Text in a Textbox when the textbox is selected
 

I must be missing something, but when I select the text box I want al
of the information in the text box selected automatically so that I ca
just start entering information and the original text is deleted.
Please help

--
RPIJ
-----------------------------------------------------------------------
RPIJG's Profile: http://www.excelforum.com/member.php...nfo&userid=928
View this thread: http://www.excelforum.com/showthread.php?threadid=48018


Tom Ogilvy

Highlight all Text in a Textbox when the textbox is selected
 
What kind of text box. Where is it located? Are you asking how to program
something or just wishing?

--
Regards,
Tom Ogilvy



"RPIJG" wrote in
message ...

I must be missing something, but when I select the text box I want all
of the information in the text box selected automatically so that I can
just start entering information and the original text is deleted.
Please help.


--
RPIJG
------------------------------------------------------------------------
RPIJG's Profile:

http://www.excelforum.com/member.php...fo&userid=9285
View this thread: http://www.excelforum.com/showthread...hreadid=480188




Leith Ross[_143_]

Highlight all Text in a Textbox when the textbox is selected
 

Hello RPIJG,

If you want to highlight the text inside a TextBox on a user form whe
the user clicks the TextBox, this code will do that.

Inset this code into the Mouse_Up Event for the TextBox. Chang
TextBox1 in the Example to match the name of your TextBox.


Code
-------------------
Private Sub TextBox1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

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

End Sub

-------------------


Sincerely,
Leith Ros

--
Leith Ros
-----------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846
View this thread: http://www.excelforum.com/showthread.php?threadid=48018


RPIJG[_75_]

Highlight all Text in a Textbox when the textbox is selected
 

Sorry Tom I guess it was a bit of both, a wish and a need to program
Leith that works great thanks

--
RPIJ
-----------------------------------------------------------------------
RPIJG's Profile: http://www.excelforum.com/member.php...nfo&userid=928
View this thread: http://www.excelforum.com/showthread.php?threadid=48018



All times are GMT +1. The time now is 06:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com