Dates in Userforms

Kris75

Board Regular
Joined
Jul 29, 2009
Messages
143
Hi Guys

I have a text box that when initalized sets the date as dd/mm/yy (01/05/10)

this is good, but when i have clicked on my command button to submit the date it converts the date as 05/jan/10

what am i doing wrong?

ActiveCell.Value = txtdate.Value
ActiveCell.NumberFormat = "dd/mm/yy"
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Try this:
Code:
ActiveCell.Value = Cdate(txtdate.Value)

This should set it to the system date format of Excel

or

Code:
ActiveCell.Value = Format(txtdate.Value, "dd/mm/yyyy")

HTH
 
Last edited:
Upvote 0
Try this:
Code:
ActiveCell.Value = Cdate(txtdate.Value)

This should set it to the system date format of Excel

or

Code:
ActiveCell.Value = Format(txtdate.Value, "dd/mm/yyyy")

HTH


Thank you, the top one did it!
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

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