Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Serial comma delimited text - Import to XL evry 8th comma nuRo


Jacob, i think you need to Dim one more variable, right.
Dim intFile, inttemp As Integer

That worked for me.
Ryan--

"Jacob Skaria" wrote:

Instead of using Line input statement use Input statement which will read one
field at a time.
Input #intFile, F1, F2, F3, F4, F5, F6, F7, F8

OR split that to an array as below. Open a new workbook. Paste the macro and
try..


Sub Mac()
Dim intFile As Integer
Dim strData As String
Dim arrData As Variant
Dim lngRow As Long, lngCol As Long
intFile = FreeFile

On Error Resume Next

Open "c:\comma.txt" For Input As #intFile
Line Input #intFile, strData
arrData = Split(strData, ",")
For intTemp = 0 To UBound(arrData) Step 8
lngRow = lngRow + 1
For lngCol = 1 To 8
Cells(lngRow, lngCol) = arrData(intTemp + lngCol - 1)
Next
Next
Close #intFile

End Sub

If this post helps click Yes
---------------
Jacob Skaria


"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

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


Thanks To all,
Best Regards
Bill


"RyGuy" wrote:

Jacob, i think you need to Dim one more variable, right.
Dim intFile, inttemp As Integer

That worked for me.
Ryan--

"Jacob Skaria" wrote:

Instead of using Line input statement use Input statement which will read one
field at a time.
Input #intFile, F1, F2, F3, F4, F5, F6, F7, F8

OR split that to an array as below. Open a new workbook. Paste the macro and
try..


Sub Mac()
Dim intFile As Integer
Dim strData As String
Dim arrData As Variant
Dim lngRow As Long, lngCol As Long
intFile = FreeFile

On Error Resume Next

Open "c:\comma.txt" For Input As #intFile
Line Input #intFile, strData
arrData = Split(strData, ",")
For intTemp = 0 To UBound(arrData) Step 8
lngRow = lngRow + 1
For lngCol = 1 To 8
Cells(lngRow, lngCol) = arrData(intTemp + lngCol - 1)
Next
Next
Close #intFile

End Sub

If this post helps click Yes
---------------
Jacob Skaria


"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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Serial comma delimited text - Import to XL evry 8th comma nuRo


Yes Ryan; missed one (intTemp)...I havent used an IDE. Thanks for pointing
that out.

If this post helps click Yes
---------------
Jacob Skaria


"RyGuy" wrote:

Jacob, i think you need to Dim one more variable, right.
Dim intFile, inttemp As Integer

That worked for me.
Ryan--

"Jacob Skaria" wrote:

Instead of using Line input statement use Input statement which will read one
field at a time.
Input #intFile, F1, F2, F3, F4, F5, F6, F7, F8

OR split that to an array as below. Open a new workbook. Paste the macro and
try..


Sub Mac()
Dim intFile As Integer
Dim strData As String
Dim arrData As Variant
Dim lngRow As Long, lngCol As Long
intFile = FreeFile

On Error Resume Next

Open "c:\comma.txt" For Input As #intFile
Line Input #intFile, strData
arrData = Split(strData, ",")
For intTemp = 0 To UBound(arrData) Step 8
lngRow = lngRow + 1
For lngCol = 1 To 8
Cells(lngRow, lngCol) = arrData(intTemp + lngCol - 1)
Next
Next
Close #intFile

End Sub

If this post helps click Yes
---------------
Jacob Skaria


"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

Reply
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
Using comma inside the comma delimited text in Data Validation/Sou LasseH Excel Programming 5 December 14th 07 04:09 AM
Import comma delimited text Lin Excel Discussion (Misc queries) 3 July 28th 06 04:07 PM
Import Comma delimited info in a Column Burger23 Excel Worksheet Functions 10 March 6th 06 03:48 AM
Can an Excel spreadsheet be exported to a comma-delimited import . jdebnam Excel Discussion (Misc queries) 1 April 21st 05 11:38 PM
I have a Comma delimited text file how do I import in to excel an. trevord Excel Discussion (Misc queries) 1 February 3rd 05 11:41 PM


All times are GMT +1. The time now is 10:42 PM.

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"