Date Format - Please Help!

Aviles

Board Regular
Joined
Dec 17, 2008
Messages
173
Office Version
  1. 365
Platform
  1. Windows
Hi all,
I'm currently using a user form with current "UserForm_Activate" settings as follows:

Code:
Private Sub UserForm_Activate()
txtDate.Text = Format(Now(), "dd/mm/yyyy")

Up to this point I'm ok, as the date on the user form defaults to dd/mm/yyyy (e.g. 28/02/2011).

I also have the below code for when the user clicks on the "Enter" button on the user form, which transfers the date from the form to the spreadsheet:

Code:
Sheets("PrimeCo Home").Select
Range("W1").Select       
 
Selection.Value = txtGMT.Value
Selection.Offset(1, 0).Value = txtDate.Value
Selection.Offset(2, 0).Value = txtClientName.Value

The date does get transfered to the spreadsheet, but in the mm/dd/yyyy format (e.g. 02/28/2011).

I've changed the format under "Format Cells", both under the "Date" and "Custom" categories... with no luck.

I have even added code which should change the format to dd/mm/yyyy:

Code:
Range("W2").Select
Selection.NumberFormat = "dd/mm/yyyy"

My computer's settings are also set up with the dd/mm/yyy format.

Can any one give me other suggestions?

Thanks in advance.
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Click the column then under data click Text To Columns, click next and choose the date format it currently it there.

Then once you click finish you can reformat the column how you want it and it will work.
 
Upvote 0
Click the column then under data click Text To Columns, click next and choose the date format it currently it there.

Then once you click finish you can reformat the column how you want it and it will work.

I clicked on cell "W2" which is the cell that the date gets incorrectly transferred to, and when I click on "Text to Columns" it give me the error message:

"No data was selected to parse"

Any suggestions?
 
Upvote 0
I've been following on with this for a while now and have searched several threads and I too am struggling with any suggestions

Is it worth removing this line from the macro and formatting W1 direct

eg =NOW() on the cell itself
 
Upvote 0
I ended up using the following formula that I got from another thread:

=IF(DAY(W2)<=12,DATE(YEAR(W2),DAY(W2),MONTH(W2)),W2)

Probably not the cleanest way to do it, but it works fine now.
 
Upvote 0
Try something like this

Range("C3").Value = Format(TextBox.Text, "dd/mm/yyyy")
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,758
Members
452,940
Latest member
rootytrip

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