![]() |
Fill Array from a CSV File
I need need help with code to open a csv file and then fill a dimensional array with data contained in a csv file. This is an example of a entry from the file. Region,12345678,0001,Ex Code,525,Cust Name,Unit no,Street No,Street,S Type,Suburb,Ex Code & Address,,,01-NOV-03,Raw Dat String,,,,,,,,123456780001,17/10/03,10/10/03 There are approx 12,000 lines (rows) in the file which will increas daily thanks in advanc ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com |
Fill Array from a CSV File
Personally I would create a new sheet and import it to
there. Then fill the array off the new sheet you have created. I am not sure of the code to do this but you should be able to record it or someone else will know. Jase -----Original Message----- I need need help with code to open a csv file and then fill a 2 dimensional array with data contained in a csv file. This is an example of a entry from the file. Region,12345678,0001,Ex Code,525,Cust Name,Unit no,Street No,Street,St Type,Suburb,Ex Code & Address,,,01-NOV-03,Raw Data String,,,,,,,,123456780001,17/10/03,10/10/03 There are approx 12,000 lines (rows) in the file which will increase daily thanks in advance ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ . |
Fill Array from a CSV File
Dim varr as Variant
workbooks.Open "C:\my files\myfile.csc varr = Activeworkbook.Worksheets(1).UsedRange.Value Activeworkbook.close Savechanges:=False now varr is a two dimensional array containing your values. -- Regards, Tom Ogilvy Jase wrote in message ... Personally I would create a new sheet and import it to there. Then fill the array off the new sheet you have created. I am not sure of the code to do this but you should be able to record it or someone else will know. Jase -----Original Message----- I need need help with code to open a csv file and then fill a 2 dimensional array with data contained in a csv file. This is an example of a entry from the file. Region,12345678,0001,Ex Code,525,Cust Name,Unit no,Street No,Street,St Type,Suburb,Ex Code & Address,,,01-NOV-03,Raw Data String,,,,,,,,123456780001,17/10/03,10/10/03 There are approx 12,000 lines (rows) in the file which will increase daily thanks in advance ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ . |
Fill Array from a CSV File
Cool!!
"Tom Ogilvy" wrote in message ... Dim varr as Variant workbooks.Open "C:\my files\myfile.csc varr = Activeworkbook.Worksheets(1).UsedRange.Value Activeworkbook.close Savechanges:=False now varr is a two dimensional array containing your values. -- Regards, Tom Ogilvy Jase wrote in message ... Personally I would create a new sheet and import it to there. Then fill the array off the new sheet you have created. I am not sure of the code to do this but you should be able to record it or someone else will know. Jase -----Original Message----- I need need help with code to open a csv file and then fill a 2 dimensional array with data contained in a csv file. This is an example of a entry from the file. Region,12345678,0001,Ex Code,525,Cust Name,Unit no,Street No,Street,St Type,Suburb,Ex Code & Address,,,01-NOV-03,Raw Data String,,,,,,,,123456780001,17/10/03,10/10/03 There are approx 12,000 lines (rows) in the file which will increase daily thanks in advance ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ . |
Fill Array from a CSV File
Tom This looks exactly like what I am after Is there a simular simple way to fill a sheet with data held in a Array Thank ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com |
Fill Array from a CSV File
Assuming myarray is a 2-D array:
rw = Ubound(myarray,1)-lbound(myarray,1)+1 col = Ubound(myarary,2)-lbound(myarray,2)+1 Range("A1").Resize(rw,col).Value = myArray -- Regards, Tom Ogilvy mudraker wrote in message ... Tom This looks exactly like what I am after Is there a simular simple way to fill a sheet with data held in an Array Thanks ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www.ExcelForum.com/ |
All times are GMT +1. The time now is 11:32 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com