Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel2007 - More columns when importing ascii file? | Excel Discussion (Misc queries) | |||
Importing Ascii file to Excell won't include Null Characters | Excel Discussion (Misc queries) | |||
importing ASCII | Excel Discussion (Misc queries) | |||
Saving Excel files takes a huge amount of time | Excel Discussion (Misc queries) | |||
Importing to Excel from ASCII | Excel Discussion (Misc queries) |