How to change US date format to UK date format - dd/mm/yyyy

vbanewbie68

Board Regular
Joined
Oct 16, 2021
Messages
171
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hi

Please could you show me how to change from US date to United Kingdom Date like this dd/mm/yyyy?

Thank you in advance

Best regards

V


1638286606774.png


Sub Add_Rows_Data()
LastRow = Imprt.Cells(1, 1).End(xlDown).Row
DatePaymentMade = WorksheetFunction.Match("DatePaymentMade", Imprt.Cells(1, 1).EntireRow, 0)
For x = 2 To LastRow

Imprt.Cells(x, DatePaymentMade).Value = DateValue(Cells(x, DatePaymentMade).Text) 'Date format

Next x

End Sub
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
You can use Text to columns for that.
Select column B, On the Data tab select text to columns, delimited, next, clear all checkboxes, next, select MDY from the date drop down, Finish.
 
Upvote 0
You can use Text to columns for that.
Select column B, On the Data tab select text to columns, delimited, next, clear all checkboxes, next, select MDY from the date drop down, Finish.
How to write it on VBA please?
R
 
Upvote 0
Just record a macro whilst you do it manually.
 
Upvote 0
Since VBA defaults to US formats, you could probably just use:

Code:
Imprt.Cells(x, DatePaymentMade).Value = Cells(x, DatePaymentMade).value
 
Upvote 0
VBA Code:
Sub FixDates5()
 ' Converts Text Dates USA format to International or Regional settings on computer
  ' edit the formatting to your preference
  ' USA is MDY  If time is in source data it remains but does not show in the formatting.
  With Selection
    .TextToColumns DataType:=xlDelimited, Tab:=0, Semicolon:=0, Comma:=0, Space:=0, Other:=0, FieldInfo:=Array(1, 5)
    .NumberFormat = "dd-mmm-yyyy"
  End With
End Sub
 
Upvote 0
Since VBA defaults to US formats, you could probably just use:

Code:
Imprt.Cells(x, DatePaymentMade).Value = Cells(x, DatePaymentMade).value
Thanks for this and got the date correct but can't rid of the time stamp.
 
Upvote 0
VBA Code:
Sub FixDates5()
 ' Converts Text Dates USA format to International or Regional settings on computer
  ' edit the formatting to your preference
  ' USA is MDY  If time is in source data it remains but does not show in the formatting.
  With Selection
    .TextToColumns DataType:=xlDelimited, Tab:=0, Semicolon:=0, Comma:=0, Space:=0, Other:=0, FieldInfo:=Array(1, 5)
    .NumberFormat = "dd-mmm-yyyy"
  End With
End Sub
Hi Dave

Thanks for this which is greatly appreciated. The question is that how to convert your VBA codes into my codes looking at Column B, DatePaymentMade? I am new to VBA code.

Warm regards

V
 
Upvote 0
"Thanks for this and got the date correct but can't rid of the time stamp."

Time does not show on your post.
Do you require an edit to the code to ignore the time?
 
Upvote 0
"Thanks for this and got the date correct but can't rid of the time stamp."

Time does not show on your post.
Do you require an edit to the code to ignore the time?
Yes please. Please see below my screen. I use this line Imprt.Cells(x, DatePaymentMade).Value = Cells(x, DatePaymentMade).value.

1638305758894.png
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,857
Members
449,051
Latest member
excelquestion515

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