Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I would like to extract data from a text file delimited by semi colons.
The text file looks like: XXX : XXX : XXX XXX : XXX : XXX XXX : XXX : XXX XXX : XXX : XXX So far I would just like to take the only the first line and put i into a 3 element array. Although inefficient, I created three separat loops for each column for clarity and since the last column may contai colons. This is what I have so far, and it seems to fail in the firs loop and I don't know why. Any help would be appreciated. Attached i the text file I am using. Sub grabSTA() ' Gets filename from cell E1 as uses it as input #1 Dim strFILENAME As String Dim textColonArray(3) As String strFILENAME = Sheet1.Range("E1").Value Open strFILENAME For Input As #1 Dim currChar, tmpTxt As String currChar = Input(1, #1) ' First Block tmpTxt = "" Do tmpTxt = tmpTxt & currChar currChar = Input(1, #1) Loop While (currChar < ":") textColonArray(0) = tmpTxt Sheet1.Range("E3").Value = Trim(textColonArray(0)) ' Second Block tmpTxt = "" Do tmpTxt = tmpTxt & currChar currChar = Input(1, #1) Loop While (currChar < ":") textColonArray(1) = tmpTxt Sheet1.Range("E4").Value = Trim(textColonArray(1)) ' Third Block tmpTxt = "" Do tmpTxt = tmpTxt & currChar currChar = Input(1, #1) Loop While ((Asc(currChar) < 10) Or (Asc(currChar) < 13) O (Not EOF(1))) textColonArray(2) = tmpTxt 'Sheet1.Range("E5").Value = Trim(textColonArray(2)) Close #1 End Sub : Attachment filename: short_sch_zny.txt Download attachment: http://www.excelforum.com/attachment.php?postid=46446 -- Message posted from http://www.ExcelForum.com |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Multiple Delimiters | New Users to Excel | |||
Multiple Delimiters | Excel Discussion (Misc queries) | |||
delimiters and manipulation | Excel Worksheet Functions | |||
Missing delimiters after 15 records | Excel Discussion (Misc queries) | |||
Parse data with uneven lengths and different delimiters | Excel Worksheet Functions |