Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Excel 2000 importing huge ASCII files into different sheets

Hello,

I would like to load a big ascii file into Excel and split it into different
worksheets within the same workbook. The criteria to split is an empty line
with the next line being 1.0 In total the files contains 147 entities.

Anybody who could help me with VBA code?

--
Goran Stjepanovic
IT Consultant
KAS IT ServiceDesk
================================================== ===
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
================================================== ===


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Excel 2000 importing huge ASCII files into different sheets

Here's an example:

Sub test()
Const cFileName = "C:\T\document.txt"
Dim intFreeFile As Integer, strTemp As String, i As Long, wks As
Worksheet
Dim blnBlankLine As Boolean

blnBlankLine = False
intFreeFile = FreeFile
Open cFileName For Input As #intFreeFile
Do Until EOF(intFreeFile)
If wks Is Nothing Then
Set wks = Worksheets.Add(after:=Worksheets(Worksheets.Count) )
i = 1
End If
Line Input #intFreeFile, strTemp
If strTemp = "" Then
blnBlankLine = True
i = i + 1
ElseIf strTemp = "1.0" And blnBlankLine Then
Set wks = Nothing
blnBlankLine = False
i = 1
Else
wks.Cells(i, 1).Value = strTemp
blnBlankLine = False
i = i + 1
End If
Loop
Close #intFreeFile
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Goran Stjepanovic" wrote in message
...
Hello,

I would like to load a big ascii file into Excel and split it into

different
worksheets within the same workbook. The criteria to split is an empty

line
with the next line being 1.0 In total the files contains 147 entities.

Anybody who could help me with VBA code?

--
Goran Stjepanovic
IT Consultant
KAS IT ServiceDesk
================================================== ===
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
================================================== ===




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Excel 2000 importing huge ASCII files into different sheets

Hello,
Thanx but it is not working.... could I send you file so you could try it?


--
Goran Stjepanovic
================================================== ===
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
================================================== ===
"Rob van Gelder" wrote in message
...
Here's an example:

Sub test()
Const cFileName = "C:\T\document.txt"
Dim intFreeFile As Integer, strTemp As String, i As Long, wks As
Worksheet
Dim blnBlankLine As Boolean

blnBlankLine = False
intFreeFile = FreeFile
Open cFileName For Input As #intFreeFile
Do Until EOF(intFreeFile)
If wks Is Nothing Then
Set wks = Worksheets.Add(after:=Worksheets(Worksheets.Count) )
i = 1
End If
Line Input #intFreeFile, strTemp
If strTemp = "" Then
blnBlankLine = True
i = i + 1
ElseIf strTemp = "1.0" And blnBlankLine Then
Set wks = Nothing
blnBlankLine = False
i = 1
Else
wks.Cells(i, 1).Value = strTemp
blnBlankLine = False
i = i + 1
End If
Loop
Close #intFreeFile
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Goran Stjepanovic" wrote in message
...
Hello,

I would like to load a big ascii file into Excel and split it into

different
worksheets within the same workbook. The criteria to split is an empty

line
with the next line being 1.0 In total the files contains 147 entities.

Anybody who could help me with VBA code?

--
Goran Stjepanovic
IT Consultant
KAS IT ServiceDesk
================================================== ===
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from your issue.
================================================== ===






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
Excel2007 - More columns when importing ascii file? MG Excel Discussion (Misc queries) 2 July 18th 07 05:44 PM
Importing Ascii file to Excell won't include Null Characters KJM Excel Discussion (Misc queries) 0 September 19th 06 09:03 PM
importing ASCII tt Excel Discussion (Misc queries) 1 March 3rd 06 03:29 AM
Saving Excel files takes a huge amount of time Heavy Excel user Excel Discussion (Misc queries) 6 January 12th 06 12:11 PM
Importing to Excel from ASCII Currie Excel Discussion (Misc queries) 5 August 26th 05 10:46 PM


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