I want to create a VBA add-in that imports a CSV file, split the data columns into separate arrays and returns these multiple arrays to the sub that calls this add-in. Not sure what is the best way to go about this.
For example, my data folder contains many CSV files where each has 5 columns of data (1st column is dates, and the remaining columns are numeric data. There is one line of header).
I also have several different workbooks that perform different types of analyses on these CSV files. Therefore, instead of reusing the same import csv data function or sub in each workbook, I want to create an add-in to perform this import function instead.
Ideally, this add-in will return 5 separate arrays for each CSV file. If not, I would be OK if it returns a 5-column array.
The code will look something like (where the SomeAnalysis Sub is in one of the Workbooks, ImportCSV is the add-in function or Sub and ncsv is the number of CSV files to be evaluated):
Sub SomeAnalysis()
For n = 1 to ncsv
[arr1,arr2,arr3,arr4,arr5]=ImportCSV(filename(n))
'Perform the analysis
next n
End Sub