Clicking the text in a textbox erases all the data in the box

D

dok112

I saw on here once a macro that if you had text in a textbox and clicke
on the text, it would erase everything out of the textbox. TIA for th
help
 
B

Bob Phillips

Is this what you mean

Private Sub TextBox1_Enter()
TextBox1.Text = ""
End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
D

dok112

Not exactly.

What it was, for example when my userform pops up, TextBox1 say
"HH:MM" and when you click on the textbox, it would automatically clea
out the "HH:MM" inorder for the user to put in the actual "01:30".
Simply, it's for entering a time, but I wanted the person that gets th
userform to know which format to insert it in.

Thanks again for your help
 
B

Bob Phillips

What I suggested will work okay for you, but with one important caveat.

To display the HH:MM in the first textboxd, you have to ensure that it
doesn't take the focus when the form is activated. Maybe put a hidden
control on the form and give that a TabIndex of 0.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
T

Tim Coddington

Possibly you could use two controls;
One label covering the text box which goes invisible on clicking it to
reveal
the textbox under it.

Bob Phillips said:
What I suggested will work okay for you, but with one important caveat.

To display the HH:MM in the first textboxd, you have to ensure that it
doesn't take the focus when the form is activated. Maybe put a hidden
control on the form and give that a TabIndex of 0.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Top