Roy_Excel_Island_Apps
Board Regular
- Joined
- Oct 9, 2018
- Messages
- 76
- Office Version
- 365
- Platform
- 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
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