VBA Converting date from UK to US

danny8890

New Member
Joined
Feb 7, 2018
Messages
46
Hi,

I've currently got some vba that merges csv's together however the date is getting transferred to US by the macro.

The date is in Column E, i've tried various things to get this to work even creating a second macro to convert the date back afterwards however this didn't work either only changed the format of the date rather than the actual date.

If anyone could assist that would be great

Code:
Do Until EOF(1)               
Line Input [URL="https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=1"]#1[/URL] , strData
                x = Split(strData, ",")
                For c = 0 To UBound(x)
                    Cells(r, c + 1).Value = Trim(x(c))
                    Next c
                r = r + 1
            Loop

thanks
 
Last edited:

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
You'd need to use CDate for that:

Code:
If Isdate(Trim(x(c))) then
Cells(r, c + 1).Value = CDate(Trim(x(c)))
else
Cells(r, c + 1).Value = Trim(x(c))
end if
 
Upvote 0

Forum statistics

Threads
1,215,465
Messages
6,124,977
Members
449,200
Latest member
Jamil ahmed

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