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

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
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,223,264
Messages
6,171,081
Members
452,377
Latest member
bradfordsam

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