Format Text Boxes within A User Form

  • Thread starter Thread starter Jacy Erdelt
  • Start date Start date
J

Jacy Erdelt

I have 2 text boxes within a user form called "EnterNewConsult" that I need
to format. One text box called "Date of Consult" needs to be formatted in the
00/00/00 date format, and the other called "Quote Amount" needs to be
formatted as $0.00. Can you help me figure out what the code would look like
for those?

Also, how would I go about entering all of the values in my text boxes from
the user form into their corresponding cells within the workbook?

Your help is greatly appreciated!
 
Give this a try:
TextBox1.Text = Format(CDbl(TextBox1.Text), "$#,##0.00")
TextBox1.Value = Format(TextBox1.Value, "dd/mm/yyyy")

Regards,
Ryan---
 
Oh, just noticed the second pary of your question.

Private Sub CommandButton1_Click()
Sheets("Sheet1").Activate
Cells(1, 1) = TextBox1.Text
Cells(2, 1) = TextBox2.Text

End Sub

Remember, (1,1) is Cell A1, (2,1) is Cell A2, etc.

Regards,
Ryan---
 
Thank you for your suggestion. It was heading in the right direction, but it
didn't quite give me the result I was hoping for. The box with the date, for
instance, only allows you to input 1 number before it automatically populates
with a date (enter 1, and 30/12/1899 comes up). And with the amount, the
first number entered is always the dollar amount and the second number
entered comes up as the cents (enter 1 & 2, $1.20 comes up). If I leave the
decimal out of the equation then it will allow me to enter all numbers
accurately, except the cents. If you have any thoughts on this, please let me
know. Thank you, again.
 
Back
Top