I need to to import some csv files into excel 2010 and create a very simple, but very large database.
The whole story will be – five columns and thousands of rows.
VBA is also simple – copy data from one sheet to another – and vice versa.
But I need to care about memory requirement, because of potentially very large file size.
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Dim r1 As Range
Dim r2 As Range
Set ws1 = Sheets("01")
Set ws2 = Sheets("02")
Set r1 = ws1.Range("A1:B10") ' for example
Set r2 = ws2.Range("C5:D14")
r1.Copy Destination:=r2 'first way
r2.Value = r1.Value ' second way
Is there any differences between this two methods, in the scope of memory/time consuming?
At the and I will have over 10,000 rows. What will be the size of the file?
This code block had some specifics for a project I was on, but should help get you started on how to import CSV files (somewhat cleaning) through VBA: