View Single Post
  #20   Report Post  
Posted to microsoft.public.excel.programming
Billp Billp is offline
external usenet poster
 
Posts: 9
Default Serial comma delimited text - Import to XL evry 8th comma nuRo


To one and all I thank you again.

To change
Open "c:\comma.txt" For Input As #intFile

To one that asks the user to search, and input the text file via explorer.

I am really appreciative and humbled for all the help.
I cannot tick all for thank you for all deserve it.
Best and Kind Regards
Bill

"keiji kounoike" <"kounoike AT mbh.nifty." wrote:

Another version.
select new worksheet and run the macro, then data will be put into this
sheet.

Sub readtest()
Dim srow As Long, scolumn As Long, k As Long
Dim OneChr
Dim fileNum
Dim filename As String

filename = "C:\test.txt" '<<==Change to your data file
fileNum = FreeFile
Open filename For Input As fileNum
srow = 1 '<<==Change starting row number if you want
scolumn = 1 '<<==Change starting column number if you want
k = 0
Do While Not EOF(fileNum)
OneChr = Input(1, fileNum)
If OneChr = "," Then
k = k + 1
Cells(srow, scolumn) = WorksheetFunction.Clean(tmp)
scolumn = scolumn + 1
tmp = ""
Else
tmp = tmp & OneChr
End If

If k = 8 Then
srow = srow + 1
scolumn = 1
k = 0
End If
Loop
Close fileNum
End Sub

Keiji

Billp wrote:
Hi,
I have a print out of a weighing scale.
It has outputted in serial text - comma delimited.
Bag Weight, Month, Day, Year, Hours, Minutes, Seconds, extra comma then
repeats.
How can I import into xl such a text file so that every 8th comma denotes a
new row?
Example:
14.1230001,6,21,2009,19,46,51,,14.1230001,6,21,200 9,19,46,53,,14.1230001,6,21,2009,19,46,54,,

Every 8th coma denotes a new row.

Help.
Regards
Bill