Force European Dates Format

pipoliveira

New Member
Joined
Feb 15, 2013
Messages
12
Dear all,
Trust you’re all well.
I have a dashboard with VBA forms that uploads csv files taken from our internal system to a specific dashboard.
All info is being pasted on the right columns and so on, the only field giving me headaches is the one is being extracted with date and time even though, on the CSV file, the cells does not recognize the info as date. They came on the following format: “dd.mm.yyyy hh:mm:ss” as attached example in column “H”.
The issue I have is with some colleagues based in the US. When I copy this info from CSV file into Excel as date, some of the dates comes in US format and some dates in European.
E.g., if one of the dates are 08.01.2019, it will reverse to 1st of August 2019 instead of 8th of January 2019.
As we do not need the hours; seconds and milliseconds, I have created a code to delete it and only paste the date.
The code I use to copy from CSV file and paste to XLSM file is the following:
Code:
‘ScWs = Source File (CSV)
‘TgWs = Target File (xlsm)

TgWs.Cells(iRowReg, 6).Resize(98, 1).NumberFormat = "@"

ScWs.Range("H2:H100").Copy

TgWs.Cells(iRowReg, 6).Resize(98, 1).PasteSpecial xlPasteValues

'Code to keep only date and delete the hours "00:00:00"
For Each Cell In Range("F14:G1000")
    If Not IsEmpty(Cell) Then
        Cell.Value = Left(Cell, 10)
    End If
Next Cell
On first line of code, I have forced to format the column target as “text” to avoid excel mix the dates.
My goal is to paste the dates and force the European format such as e.g. “1st March 2019”.
Any ideas will be highly appreciated.
Best regards,
Filipe
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Cross posted https://www.excelforum.com/excel-programming-vba-macros/1267439-force-european-dates-format.html

While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,561
Members
449,089
Latest member
Motoracer88

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