Format Text Box

k209310

Active Member
Joined
Aug 12, 2002
Messages
382
I have seen the post on formatting the text box and this got m,e thinking.

How would it be possible to force a user to enter a date as dd/mm/yyyy for example?

Ie return an error message if format is incorrect or prevent the user fom entering letter.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Use the BeforeUpdate to check what the user entered, compare it to your "standard" and if it's wrong, set the Cancel parameter to True so the user is forced to put a correct value. You can show a message by using MsgBox.
 
Upvote 0
Thabnks for the reply its exactly what i want.

Could someone set the cancel = True bit in a bit more detail please. Im not too sure about it.
This message was edited by k209310 on 2002-11-07 11:12
 
Upvote 0
Something like this, where TextBox1 is the name of your TextBox.<pre>Private Sub TextBox1_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
If MyCondition = False Then
'User screw up
MsgBox "Hey, correct me !"
Cancel = True
End If
End Sub</pre>
 
Upvote 0

Forum statistics

Threads
1,214,989
Messages
6,122,622
Members
449,093
Latest member
catterz66

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top