Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() does this give you the start you need? it writes the lines of the blocks to columns 1 and 2 of the activesheet once this has run you can parse those ranges with texttocolumns method Sub ReadFromAscii() Dim sLine$, sBlock$ Dim a&, c& Open "c:\myascii.txt" For Input As #1 Do While Not EOF(1) Line Input #1, sLine If Left(sLine, 1) = "~" Then If Left(sLine, 2) = "~C" Then sBlock = "C" ElseIf Left(sLine, 2) = "~A" Then sBlock = "A" Else sBlock = "" End If Else Select Case sBlock Case "C" c = c + 1 ActiveSheet.Cells(c, 1) = sLine Case "A" a = a + 1 ActiveSheet.Cells(a, 2) = sLine End Select End If Loop Close #1 End Sub keepITcool < email : keepitcool chello nl (with @ and .) < homepage: http://members.chello.nl/keepitcool ?B?ZHJib2JzbGVk?= wrote: I have an ascii file that has data organized in blocks. Each block's header line has a "~" in column 1. eg. ~Well Information Block How can I import the data in the "Curve information block" and the "~ASCII DEPTH" or sometimes called "~A DEPTH" blocks only? I 've included some sample data. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Import csv file - blank lines inserted | Excel Discussion (Misc queries) | |||
How do I convert excel file into ASCII text file with alignment? | Excel Discussion (Misc queries) | |||
Ascii file import round 3 | Excel Programming | |||
ascii file import round 2 | Excel Programming | |||
Import ascii file | Excel Programming |