Hello,
I receive an automatically generated report that contains a single sheet with around 540,000 used rows. In column J the file contains a date/time format that looks like this: 2023-08-02T16:26:42 I have emphasized the "T". The file is a .csv file. I have used the below code to remove the "T" in another csv file with larger number of rows used (790,000) successfully but with this file, after about 150,000 rows it starts generating a #N/A. I have checked for extra spaces and all good in that front.
Any assistance is greatly appreciated.
I receive an automatically generated report that contains a single sheet with around 540,000 used rows. In column J the file contains a date/time format that looks like this: 2023-08-02T16:26:42 I have emphasized the "T". The file is a .csv file. I have used the below code to remove the "T" in another csv file with larger number of rows used (790,000) successfully but with this file, after about 150,000 rows it starts generating a #N/A. I have checked for extra spaces and all good in that front.
VBA Code:
Sub RemoveTFromData ()
Dim v As Long
Dim LastRowJ As Long
Dim arrJ() As Variant
Application.ScreenUpdating = False
Application.DisplayAlerts = False
' Define variables.
LastRowJ = Sheets("Report").Range("J" & Rows.Count).End(xlUp).Row
' Define and load Arrays to be used for columns J.
arrJ = Application.Transpose(Sheets("Report").Range("J3:J" & LastRowJ))
' Loop through arrays to remove "T" value and re-format column J.
For v = 1 To UBound(arrJ)
arrJ(v) = Replace(arrJ(v), "T", " ")
Next v
' Write arrays back to column.
Sheets("Report").Range("J3:J" & LastRowJ) = Application.Transpose(arrJ)
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
Any assistance is greatly appreciated.