ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Clicking the text in a textbox erases all the data in the box (https://www.excelbanter.com/excel-programming/305110-clicking-text-textbox-erases-all-data-box.html)

dok112[_20_]

Clicking the text in a textbox erases all the data in the box
 
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

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

Clicking the text in a textbox erases all the data in the box
 
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)

"dok112 " wrote in message
...
I saw on here once a macro that if you had text in a textbox and clicked
on the text, it would erase everything out of the textbox. TIA for the
help.


---
Message posted from http://www.ExcelForum.com/




dok112[_21_]

Clicking the text in a textbox erases all the data in the box
 
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

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

Clicking the text in a textbox erases all the data in the box
 
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)

"dok112 " wrote in message
...
Not exactly.

What it was, for example when my userform pops up, TextBox1 says
"HH:MM" and when you click on the textbox, it would automatically clear
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 the
userform to know which format to insert it in.

Thanks again for your help.


---
Message posted from http://www.ExcelForum.com/




Tim Coddington

Clicking the text in a textbox erases all the data in the box
 
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" wrote in message
...
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)

"dok112 " wrote in message
...
Not exactly.

What it was, for example when my userform pops up, TextBox1 says
"HH:MM" and when you click on the textbox, it would automatically clear
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 the
userform to know which format to insert it in.

Thanks again for your help.


---
Message posted from http://www.ExcelForum.com/







All times are GMT +1. The time now is 03:47 AM.

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