LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
D.Parker
 
Posts: n/a
Default Search/Extract Data w/in Text File

Hello again! I am searching within a text file for the last row within the
file. After I locate the row I need to separate the data and place into
multiple cells on my worksheet. The code I have is as follows:

Dim TextPath As String
Dim DelimSrchChar As String
Dim METtime As String

Dim DataBuffer As Variant
Dim NCData As Variant

Dim DelimPos As Integer
'===============================================

DelimSrchChar = ","

TextPath = "C:\Temp\Formatted_NC_SN1008.txt"

Open TextPath For Input As #1 'open text file for SN1008

Do While Not EOF(1) 'go while not end of text file

Line Input #1, NCData

If EOF(1) Then
DelimPos = InStr(NCData, DelimSrchChar)

MsgBox DelimPos

Application.Cells(1, 2) = NCData

End If

Loop

Close #1

End Sub

NCData looks like this: 000:03:42:53,3.40426,20.,18.9623. I can get the
data, but I am having trouble finding a method for parsing the data and
placing the parsed data into multiple cells.

The problem: I can use the InStr function to get the data to the left of
the first delimiter as position 13 (i.e. 000:03:42:53) , but how can I get
the data between delimiter positions 13 and 21 (i.e. 3.40426) and between
delimiter positions 21 and 26 (i.e. 20.XX), and to the right of delimiter
position 26 (i.e. 18.9623)? The data sizes can change so they are not
necessarily fixed.

Thanks you.

D.Parker
 
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
Excel data query locks source file jim.bahr Excel Discussion (Misc queries) 0 June 10th 05 05:48 AM
Convert excel file to flat text file Gary's Student Excel Discussion (Misc queries) 0 June 1st 05 12:17 AM
Formatting of Data from .CSV file Night Owl Excel Worksheet Functions 0 May 10th 05 05:40 PM
Append the data given in diff sheets of an Excel File to one sheet sansk_23 Excel Worksheet Functions 3 May 10th 05 02:00 AM
problem working with time data imported from text file afaqm Excel Worksheet Functions 1 February 24th 05 08:02 AM


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