I have a CSV file that exceeds the Excel raster (6 columns and over 1.500.000 rows). With a VBA code, I want to rearrange the data within that CSV and place it in an Excel sheet in a more convenient form. The issue is when I converted the CSV into a XLSX with Macros, the end result doesn't include all the data (makes sense since XLSX didn't load all the data from the CSV). I've tried to split the CSV data set into two subsets but I still get a memory issue when running the VBA-code. I can go ahead and split the CSV into more smaller subsets, but I was wondering if there is a more efficient way to solve the problem. E.g. would that be better to open the CSV in MS Access, run the VBA from there, and then create an Excel sheet as output of the VBA?
Any help?
Thank you!
The VBA-code (where Out_VBA is the sheet with the end result):
Sub looparray()
Dim MyWorkbook As Workbook
Set MyWorkBook = ThisWorkbook
Dim MyTable As Worksheet
Set MyTable = MyWorkbook.Sheets("MyTable")
Dim tact As Long
Dim station As Long
Dim oarray As Variant
Dim rw As Long
tact = 1
station = 1
oarray = MyTable.Cells(2, 1).CurrentRegion
For rw = 2 To UBound(oarray)
tact = MyTable.Cells(rw, 4)
station = MyTable.Cells(rw, 2)
If oarray(rw, 5) > 0 Then
Out_VBA.Cells(tact, station) = oarray(rw, 1) & oarray(rw, 3) & oarray(rw, 5) & "+" & oarray(rw, 6)
End If
Next
End Sub