always_confused
Board Regular
- Joined
- Feb 19, 2021
- Messages
- 68
- Office Version
- 2016
- Platform
- Windows
Hello, I am trying to convert about 75 000 lines of datetime formate data (YYYY/MM/DD HH:MM:SS) into just dates (YYYY/MM/DD). The only way I have found to do this it to concatenate the YEAR(), MONTH(), DAY() parts of the data in one column into another column. However, with so many rows, this takes FOREVER and makes Excel stop responding. There must be a better way to do this, but I just don't know what it is. I need to do this only for date on the row where another value is <> 0. Here's my code:
VBA Code:
Dim lastrow As Long
lastrow = Sheets("lot").Range("A" & Rows.count).End(xlUp).Row
For i = lastrow
If Sheets("sheet1").Range("A" & i ).value <> 0 Then
Sheets("sheet2").Range("A" & Rows.count).End(xlUp).Offset(1, 0).value = Year(Sheets("sheet1").Range("B" & i).value) & "/" & Month(Sheets("sheet1").Range("B" & i).value) & "/" & Day(Sheets("sheet1").Range("B" & i).value)
End If
Next i