Convert false DATE column to real DATE column

Roy_Excel_Island_Apps

Board Regular
Joined
Oct 9, 2018
Messages
76
Office Version
  1. 365
Platform
  1. Windows
Hi colleagues,

I have a DATE column transfered from an Access database, but Excel recognises it as a text (that's why it's aligned on the left). When you enter a cell in the date column and press Enter, the date will align on the right and will be recognised as a date and I will be able to use it in formulas. I have written a small procedure to convert each cell in the range to a date in the right format because I don't want to enter every cell in the column. But this procedure takes a long time in a rng of 30.000 records... Does someone have a solution to convert a large range of dates to real dates? I have already tried TextToColumns method as well... That's working for numbers, but not for dates. Other ideas?

Sub convertDate(rng As Range)


Dim aDate As Date
Dim cell As Range

For Each cell In rng

aDate = Format(CDate(cell.Value), "dd/mm/yyyy")
cell.Value = aDate

Next

End Sub
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Upvote 0
Given data provided, below should work:

Selection.TextToColumns Destination:=Selection.Range("A1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 4), TrailingMinusNumbers:=True
 
Last edited:
Upvote 0
Glad we could help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,215,729
Messages
6,126,525
Members
449,316
Latest member
sravya

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