Date Change

vmjan02

Well-known Member
Joined
Aug 15, 2012
Messages
1,134
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
Not sure as it is not converting the date,
the data is there, the code is not convert mm/dd/yyyy to dd-mm-yyyy

the problem is if till 12 day of any month the date come as mm/dd/yyyy and as it 13 day of any month then the input file comes as dd-mm-yyyy

so need a code that will fix the to dd-mm-yyyy always.

VBA Code:
Sub datachange()

Application.Wait (Now + TimeValue("0:00:02"))
  Range("B2:B80000").TextToColumns Destination:=Range("B2"), DataType:=xlDelimited, _
        TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=False, _
        Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
        :=Array(1, 4), TrailingMinusNumbers:=False
  Range("B2:B80000").NumberFormat = "dd-mm-yyyy"

End Sub

Book3
B
1CREADTED_DATE
22/11/2023
331-10-2023
431-10-2023
531-10-2023
631-10-2023
71/11/2023
81/11/2023
91/11/2023
101/11/2023
111/11/2023
121/11/2023
132/11/2023
1431-10-2023
1531-10-2023
1631-10-2023
1731-10-2023
1831-10-2023
1931-10-2023
2031-10-2023
2131-10-2023
2231-10-2023
231/11/2023
Sheet1
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Afraid not, as I am still not in a position where I can change my regional date settings
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

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