Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,388
Default Import a CSV into an array?

I'm trying to import a csv file into a 2D array in VBA, for example:

myFile(column_count,row_count), is this possible?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Import a CSV into an array?

On Oct 22, 3:17*pm, Dave wrote:
I'm trying to import a csv file into a 2D array in VBA, for example:

myFile(column_count,row_count), is this possible?

Thanks


One way that comes to mind is to first import the csv file into a
worksheet then use the following code:

Assuming you've imported the sheet into Sheet1:

Sub Create2DArray()

Dim TwoDArray() As Variant

TwoDArray = Sheets(1).UsedRange.Value

End Sub
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Import a CSV into an array?

Dave: As I responded yesterday, you have to open the file and read one line
at a time. then use the split functions to seperate athe data into an array.

"Dave" wrote:

I'm trying to import a csv file into a 2D array in VBA, for example:

myFile(column_count,row_count), is this possible?

Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,388
Default Import a CSV into an array?

A good idea, I'm actually trying to avoid importing the data into a tab,
however, because I'm still in Excel 2003 and I'd run into the 65k column and
256 row limits that way...

"signon77" wrote:

On Oct 22, 3:17 pm, Dave wrote:
I'm trying to import a csv file into a 2D array in VBA, for example:

myFile(column_count,row_count), is this possible?

Thanks


One way that comes to mind is to first import the csv file into a
worksheet then use the following code:

Assuming you've imported the sheet into Sheet1:

Sub Create2DArray()

Dim TwoDArray() As Variant

TwoDArray = Sheets(1).UsedRange.Value

End Sub

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Import a CSV into an array?

If your datra is that large, you should import the data into multiple columns
or worksheets.

"Dave" wrote:

A good idea, I'm actually trying to avoid importing the data into a tab,
however, because I'm still in Excel 2003 and I'd run into the 65k column and
256 row limits that way...

"signon77" wrote:

On Oct 22, 3:17 pm, Dave wrote:
I'm trying to import a csv file into a 2D array in VBA, for example:

myFile(column_count,row_count), is this possible?

Thanks


One way that comes to mind is to first import the csv file into a
worksheet then use the following code:

Assuming you've imported the sheet into Sheet1:

Sub Create2DArray()

Dim TwoDArray() As Variant

TwoDArray = Sheets(1).UsedRange.Value

End Sub

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to import web query as array? Sam_stock Excel Discussion (Misc queries) 0 April 26th 07 03:58 PM
how to import a 2-d array into excel using vba? Krussell172 Excel Programming 1 August 24th 06 07:37 PM
Import Text File Directly to an Array Adrian T[_4_] Excel Programming 5 August 24th 06 07:46 AM
import array text to row data in excel nduy Excel Programming 2 January 3rd 04 09:34 AM


All times are GMT +1. The time now is 08:56 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"