ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Highlight/Select text in User Form? (https://www.excelbanter.com/excel-discussion-misc-queries/158139-highlight-select-text-user-form.html)

Alan Smith

Highlight/Select text in User Form?
 
I have created a User Form for data entry, some of the boxes in which contain
text, as a guide of what to enter. Is there a way, when the user tabs to
these boxes, to highlight/select the text so it is overwritten when they
type, as opposed to the them manually selecting and deleting the text before
entering?

I'm sure I saw something somewhere, but I can't find it now when I need it
(typical!). Thanks,

Alan

Bob Phillips

Highlight/Select text in User Form?
 
Private Sub TextBox1_Enter()
With Me.TextBox1
.SelStart = 0
.SelLength = Len(.Text)
.SetFocus
End With
End Sub


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Alan Smith" wrote in message
...
I have created a User Form for data entry, some of the boxes in which
contain
text, as a guide of what to enter. Is there a way, when the user tabs to
these boxes, to highlight/select the text so it is overwritten when they
type, as opposed to the them manually selecting and deleting the text
before
entering?

I'm sure I saw something somewhere, but I can't find it now when I need it
(typical!). Thanks,

Alan




Alan Smith

Highlight/Select text in User Form?
 
Thanks Bob, that worked a treat!

"Bob Phillips" wrote:

Private Sub TextBox1_Enter()
With Me.TextBox1
.SelStart = 0
.SelLength = Len(.Text)
.SetFocus
End With
End Sub


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Alan Smith" wrote in message
...
I have created a User Form for data entry, some of the boxes in which
contain
text, as a guide of what to enter. Is there a way, when the user tabs to
these boxes, to highlight/select the text so it is overwritten when they
type, as opposed to the them manually selecting and deleting the text
before
entering?

I'm sure I saw something somewhere, but I can't find it now when I need it
(typical!). Thanks,

Alan






All times are GMT +1. The time now is 02:38 PM.

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