mikke3141
03-19-2010, 02:11 PM
Hello,
How can I move an imported csv file that I have transferred to an array, to be used as a named range for vlookup.
Sub Give_it()
file_name = file_name & "D:\test.csv"
fnum = FreeFile
whole_file = Input$(LOF(fnum), #fnum)
Close fnum
lines = Split(whole_file, vbCrLf)
num_rows = UBound(lines)
one_line = Split(lines(0), ",")
num_cols = UBound(one_line)
ReDim the_array(num_rows, num_cols)
For R = 0 To num_rows
one_line = Split(lines(R), ",")
For C = 0 To num_cols
the_array(R, C) = one_line(C)
Next C
Next R
End Sub
Above the import to array code.
How can I move an imported csv file that I have transferred to an array, to be used as a named range for vlookup.
Sub Give_it()
file_name = file_name & "D:\test.csv"
fnum = FreeFile
whole_file = Input$(LOF(fnum), #fnum)
Close fnum
lines = Split(whole_file, vbCrLf)
num_rows = UBound(lines)
one_line = Split(lines(0), ",")
num_cols = UBound(one_line)
ReDim the_array(num_rows, num_cols)
For R = 0 To num_rows
one_line = Split(lines(R), ",")
For C = 0 To num_cols
the_array(R, C) = one_line(C)
Next C
Next R
End Sub
Above the import to array code.