ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel VBA - Userform textbox formatting (https://www.excelbanter.com/excel-programming/293227-excel-vba-userform-textbox-formatting.html)

thesteelmaker[_4_]

Excel VBA - Userform textbox formatting
 
Hi, i have created a form for an Excel SSheet, with various textboxs an
combo boxs. All work fine in that the data entered/selected ends up i
the cells required.

My problem is that it would like some formatting for the textboxs. Th
first box contains the date:

txtDate.Value = Date

The date appears on the form as d/m/yy, but i would like it to b
dd/mm/yy.

Also when this date is placed in a cell, it is in general format jus
as 1/3/04 and not as 38047, it isn't a true date.

Lastly how can i apply some conditional formatting for the other boxs
i.e

txtWeight

Number to 0 or 1 decimal places.

An error message/retry - cancel button if the number is <50 and 100.

Many Thank

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


Harald Staff

Excel VBA - Userform textbox formatting
 
"thesteelmaker " wrote in message
...

txtDate.Value = Date

The date appears on the form as d/m/yy, but i would like it to be
dd/mm/yy.


txtDate.Text = Format$(Date, "dd/mm/yy")

.. Also when this date is placed in a cell, it is in general format just
as 1/3/04 and not as 38047, it isn't a true date.


Sure it is. Just format the cell in date format and see for yourself. The system is
actually 38047 days since new year to 1900; which is 1/3/04.

--
HTH. Best wishes Harald
Followup to newsgroup only please




All times are GMT +1. The time now is 11:29 AM.

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