#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 26
Default importing list

I have a text file list of over 500 thousand one-field records. What
the best way to import this list into Excel? I'm running up against a
constraint on the # of rows allowed. Ideally, I'd like the records
fill-in to the next column should the row limit in the current column
be reached. My intention is to try to match values from one sheet to
this database of records.

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 427
Default importing list

I think the only way to do it is with code: try this on a blank
sprdsht. You'll need to provide the full directory path and filename
on the "Open" line.

Sub Import_BD_Textfile()
Dim Lyne As String 'variable to hold entry from file
Dim K As Long 'line counter

Application.Calculation = xlCalculationManual

Range("a1").Select 'start in cell A1

Open "c:\full path\filename.txt" For Input As #1

Do While Not EOF(1)
Line Input #1, Lyne 'read a line from the source file into memory
Lyne = Trim(Lyne) 'remove any leading or trailing blanks
ActiveCell.Offset(K, 0).Value = Lyne 'write the entry to the file
K = K + 1
If K = 65500 Then 'start a new column when row 65500 is filled
K = 0
ActiveCell.Offset(0, 1).Select
End If
Loop

Close #1
Application.Calculation = xlCalculationAutomatic
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 26
Default importing list

Thanks for the code. I'm not familiar with VBA. Could you describe
how to implement your code, i.e. where to put it and how to run it?

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 26
Default importing list

Please disregard the previous email. I figured out how to run the
code. Thanks it worked perfectly.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 427
Default importing list

Glad to help!

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
auto updating list Larry Excel Worksheet Functions 8 July 27th 06 01:59 PM
Drop-down list Populated by a Subset of a larger list RJH Excel Worksheet Functions 3 March 31st 06 10:28 PM
multiple select from the drop down list in excel. list in one sheet and drop down in sriramus Excel Discussion (Misc queries) 5 October 27th 05 06:55 PM
Refresh a Validation List? jhollin1138 Excel Discussion (Misc queries) 3 February 17th 05 05:48 PM
How to import a path/filename when importing data into an XML list cxparker Excel Worksheet Functions 0 December 7th 04 10:13 PM


All times are GMT +1. The time now is 01:50 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"