Help with TextBox date Formatting

RJSIGKITS

Board Regular
Joined
Apr 15, 2013
Messages
109
Hi Forum.

I am really struggling with the date formatting of a textbox on a userform playing silly sods when transferring the data to a cell...
I need a dd/mm/yyyy format, however If I run the user form and add a date of 01/05/2014 to the textbox it applies to the cell as 05/01/2014, however, when I added 26/06/2014, it added correctly - any idea's?
Here's what I've got:
Code:
Private Sub TxtBxDate_Change()ThisWorkbook.Sheets("Supplier Order Log").Range("E3").Value = TxtBxDate.Value
End Sub

With
Code:
Private Sub UserForm_Initialize()TxtBxDate.Text = Format(Date, "dd/mm/yyyy")
End Sub

And my cell E3 on the "Supplier Order log" Sheet is formatted as Date, as dd/mm/yyyy

It appears that if the 'Day' number is smaller than 12, then it seems to assume that it is a month rather than a day - would that be what it's doing? I played around with a number of different dates using smaller days, but as soon as I add 13/12/2014 it formats correctly.
Also, I think I've just noticed that it keeps auto updating the date to todays date?.... Maybe not though, it might be doing something as I'm playing around with it....

Please help - any better solutions would be much appreciated.

Thanks in advance, guys!
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Try

Code:
Private Sub TxtBxDate_Change()
ThisWorkbook.Sheets("Supplier Order Log").Range("E3").Value = DateValue(TxtBxDate.Value)
End Sub
 
Upvote 0
Upvote 0
Just to note - I have resolved my original issue simply by formatting the cell as 'Text' rather than date so it simply reads the TextBox as it is.

Thanks
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,928
Members
449,094
Latest member
teemeren

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