ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Format Text Boxes within A User Form (https://www.excelbanter.com/excel-programming/425589-format-text-boxes-within-user-form.html)

Jacy Erdelt[_2_]

Format Text Boxes within A User Form
 
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!

ryguy7272

Format Text Boxes within A User Form
 
Give this a try:
TextBox1.Text = Format(CDbl(TextBox1.Text), "$#,##0.00")
TextBox1.Value = Format(TextBox1.Value, "dd/mm/yyyy")

Regards,
Ryan---

--
RyGuy


"Jacy Erdelt" wrote:

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!


RyGuy

Format Text Boxes within A User Form
 
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---


"ryguy7272" wrote:

Give this a try:
TextBox1.Text = Format(CDbl(TextBox1.Text), "$#,##0.00")
TextBox1.Value = Format(TextBox1.Value, "dd/mm/yyyy")

Regards,
Ryan---

--
RyGuy


"Jacy Erdelt" wrote:

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!


JacyErdelt

very close, but not quite
 
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.


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

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