LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Import and Split CSV

Try the following code:

Sub AAA()

Dim FNum As Integer
Dim RowNdx As Long
Dim FName As String
Dim V As Variant
Dim WS As Worksheet
Dim ColNdx As Long
Dim Arr As Variant

FNum = FreeFile
FName = "H:\Temp2\Test.txt"
RowNdx = 1
Set WS = Worksheets(1)
Open FName For Input As FNum
Do Until EOF(FNum)
Line Input #1, V
Arr = Split(V, ",")
For ColNdx = 0 To UBound(Arr)
WS.Cells(RowNdx, ColNdx + 1) = Arr(ColNdx)
Next ColNdx
ColNdx = 1
RowNdx = RowNdx + 1
If RowNdx = Rows.Count Then
RowNdx = 1
With ActiveWorkbook.Worksheets
Set WS = .Add(after:=.Item(.Count))
End With
End If
Loop

Close FNum
End Sub



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com





"mpeplow"
wrote in message
...

I need to import a csv file into excel but the file is way too
big to
load onto a single speadsheet. How would have excel import the
file,
then once a sheet is full, create a new sheet and continue the
import?



--
mpeplow
------------------------------------------------------------------------
mpeplow's Profile:
http://www.excelforum.com/member.php...o&userid=34812
View this thread:
http://www.excelforum.com/showthread...hreadid=545694



 
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
xml import....Size limit?? Can the XML file be split?? MatthewG Excel Discussion (Misc queries) 0 February 10th 09 06:04 PM
import XML data...Is there a size limit on the import? MatthewG Excel Discussion (Misc queries) 0 February 10th 09 05:57 PM
How do I remove split a split window? Norm New Users to Excel 3 July 19th 08 10:31 PM
How to Start Excel in Text Import Wizard for data import rlelvis Setting up and Configuration of Excel 0 July 10th 08 08:40 PM
I can import Access Tables. But, I can't import Access queries nickg420[_8_] Excel Programming 0 August 5th 04 07:46 PM


All times are GMT +1. The time now is 07:18 AM.

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

About Us

"It's about Microsoft Excel"