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

  • Thread starter Thread starter dok112
  • Start date Start date
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
 
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)
 
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
 
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)
 
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top