Excel date format issue

Paterson

New Member
Joined
Jan 8, 2018
Messages
10
Hi everyone, how are youyou doing?
My problem is that I Have a colums "C"
With data of the type 1.12.17
I want to change these data to the date format 01/12/17 (dd/mm/yy)

I use a VBA code to replace all the dots with "/"
The code looks like this:

Sub ReplaceDots()
Dim i, k As String
i = "."
k = "/"
Columns("C").Replace what:=i, Replacement:=k, lookat:=xlPart, MatchCase:=False

End Sub

It works fine but the problem is, instead of getting 01/12/17 (dd/mm/yy) Spanish date Format
I get 12/01/17 (dd/mm/yy)

So December 1rst, 2017 becomes January 12rd, 2017.

Is there a way to fix this? because the column has about 3000 cells of data I can't change it manually.

Cheers,
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
My system is setup for the US regional locale, so I cannot test this for you, but I am nearly positive it will work for you. You do not need to use VB code to fix your dates, try this instead...

1) Select Column C

2) Click the "Text to Columns" button ("Data" tab, "Data Tools" panel)

3) Select the "Delimited" option, then click the "Next" button

4) Make sure the "Other" option is not checked, then click the "Next" button

5) Click the "Date" option and select "DMY" from its drop down.

6) Click the "Finish" button

If your Spanish system works like my US system, all your dates in Column C should now be real, correct dates.
 
Upvote 0
My system is setup for the US regional locale, so I cannot test this for you, but I am nearly positive it will work for you. You do not need to use VB code to fix your dates, try this instead...

1) Select Column C

2) Click the "Text to Columns" button ("Data" tab, "Data Tools" panel)

3) Select the "Delimited" option, then click the "Next" button

4) Make sure the "Other" option is not checked, then click the "Next" button

5) Click the "Date" option and select "DMY" from its drop down.

6) Click the "Finish" button

If your Spanish system works like my US system, all your dates in Column C should now be real, correct dates.

Thanks Rick Rothstein for taking the time to answer.
Your method works perfecly.

 
Upvote 0

Forum statistics

Threads
1,216,119
Messages
6,128,946
Members
449,480
Latest member
yesitisasport

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