Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 30
Default import from text file

have a text file that is more lines than can fit in a single worksheet in
excel how do I import the data from that text sheet on to multiple sheets
without importing the same lines more than once.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 142
Default import from text file

You could open the txt file in notepad, cut half of it, paste and save it as
1.txt the other half as 2.txt
then open each in a separate excel sheet
Not that this is the best way if you need to do this more often, but it
should work.


"jason2444" wrote:

have a text file that is more lines than can fit in a single worksheet in
excel how do I import the data from that text sheet on to multiple sheets
without importing the same lines more than once.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 427
Default import from text file

Another alternative is to run this code: it opens the original file and
creates sequentially numbered sub-files, which you can import to Excel.
Note you'll need to adjust the file path and possibly the TXT file
extension. The sub-files are called "Target" in this code, which you
can change- but you'll need to change all instances within the code.
You can adjust the number of rows per file from 60,000 to whatever is
appropriate. Enjoy!

Sub Import_Trim()
Dim Lyne As String
Dim FileCount As Byte, K As Byte
FileCount = 1

Open "c:\directory path\Source File Name.txt" For Input As #1
Open "c:\directory path\Target1.txt" For Output As #2

On Error Resume Next
Do While Not EOF(1)
For K = 1 To 60000
Line Input #1, Lyne
Print #2, Lyne
Next K

Close #2
FileCount = FileCount + 1
Open "c:\directory path\Target" & FileCount & ".txt" For Output As #2
Loop

Close #1
Close #2
MsgBox "Done."
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
Stop excel from dropping the 0 in the beginning of a number? Rosewood Setting up and Configuration of Excel 12 April 4th 23 02:12 PM
How to import a text file to Excel treating all input content are in string. Chittu Excel Discussion (Misc queries) 1 July 22nd 05 06:37 AM
Formulas dealing with text data Bagia Excel Worksheet Functions 6 June 20th 05 10:29 PM
how do I enable "import text file" excel 2002? jw_schmid Excel Discussion (Misc queries) 2 February 9th 05 10:39 PM
Read Text File into Excel Using VBA Willie T Excel Discussion (Misc queries) 13 January 8th 05 12:37 AM


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