Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default opening a large text or csv file

Hi,

I am trying to write a macro where I have to import a large text or CSV
file. The number of rows in the file is something like 805000 (number of
columns if just 2). Obviously excel cannot handle rows greater than
65536.
I want to open 1000 rows at a time and put it in the excel sheet, then
open another 1000 and so on. How can I do this ? Please help. If you
have a better way of doing this please let me know as well. Thanks

Srikanth



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default opening a large text or csv file


when i have to use a file larger than what excel can handle I usaull
just open it with access first so then import to excel 65000 cells a
a time, while its not the most wieldy it does work

Cheer

--
clan
-----------------------------------------------------------------------
clane's Profile: http://www.excelforum.com/member.php...fo&userid=1186
View this thread: http://www.excelforum.com/showthread.php?threadid=27502

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default opening a large text or csv file

Sub LargeFileImport()

Dim ResultStr As String
Dim FileName As String
Dim FileNum As Integer
Dim Counter As Double
FileName = InputBox("Please enter the Text File's name, e.g.
S:\Revenue\Straus\BATCHOCCMUM121002.txt")
If FileName = "" Then End
FileNum = FreeFile()
Open FileName For Input As #FileNum
Application.ScreenUpdating = False
Workbooks.Add template:=xlWorksheet
Counter = 1
Do While Seek(FileNum) <= LOF(FileNum)
Application.StatusBar = "Importing Row " & _
Counter & " of text file " & FileName
Line Input #FileNum, ResultStr
If Left(ResultStr, 1) = "=" Then
ActiveCell.Value = "'" & ResultStr
Else
ActiveCell.Value = ResultStr
End If

If ActiveCell.row = 65536 Then
ActiveWorkbook.Sheets.Add
Else
ActiveCell.Offset(1, 0).Select
End If
Counter = Counter + 1
Loop
Close
Application.StatusBar = False

End Sub


clane wrote in message ...
when i have to use a file larger than what excel can handle I usaully
just open it with access first so then import to excel 65000 cells at
a time, while its not the most wieldy it does work

Cheers

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
Large text file toby131 Excel Discussion (Misc queries) 4 September 28th 09 10:53 PM
why is my simple text file so large (22 kb) jbt Excel Discussion (Misc queries) 1 May 8th 07 05:22 PM
Trouble opening large size Excel file 155Mb in Excel 2007 pl2c Excel Discussion (Misc queries) 2 July 14th 06 11:45 PM
Opening large text files freekrill Excel Discussion (Misc queries) 6 September 7th 05 04:44 AM
VBA Excel: Opening Very Large Text Files [email protected] Excel Programming 6 September 21st 03 07:30 PM


All times are GMT +1. The time now is 02:39 PM.

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"