Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I'd have to actually see the file to be able to trace the problem with the "stepping" that you are reporting. If you want, you can send the file to me directly and I'll take a look at it... just remove the NO.SPAM stuff from my return email address. -- Rick (MVP - Excel) "Billp" wrote in message ... Thanks Rick, I had an extra gap between the coma's. I had some typos - I cut and pasted this time and works exceptionally well. Rows 1 to 10 align correctly. rows 11 to 20 are stepped one cell to the right. Rows 21 to 70 are back in line. Rows 71 to 80 step right 1 cell Rows 81 to 130are in line 131 to 136 step right looks like every 50 rows are in line, with 10 rows stepped right 1 cell then repeats - weird? Thanks Rick so much indebted to you. Best Regards Bill "Rick Rothstein" wrote: Did you use the code **exactly** as I posted it, or did you modify it in some way? If you modified it, then you will need to post what you have. The error you are getting sounds like you didn't run this line... Lines = Split(TotalFile, ",,") which appears immediately in front of the line of code you are saying errored out. -- Rick (MVP - Excel) "Billp" wrote in message ... Greetings, Thank you In the line Set R = ActiveSheet.Cells(2, "A").Resize(UBound(Lines) + 1) The code traps at UBound " Expecting Array" ? Is there any way not to dump everything into column A and one cell? I have tried most if not all of the very welcome code examples. The one mac() worked well and I am thankful - it would be nice if each group of 8 was on a new row - is this possible? Kind Regards Bill "Rick Rothstein" wrote: There is one caveat that comes with my code, though... see Dave's latest response to me and my response back to him. -- Rick (MVP - Excel) "KC" wrote in message ... Even better. I am imagining their speed. Vooom "Rick Rothstein" wrote in message ... How about this non-looping solution then? Sub ImportText() Dim R As Range Dim X As Long, FileNum As Long Dim TotalFile As String, Lines() As String FileNum = FreeFile Open "d:\temp\ExcelTest.txt" For Binary As #FileNum TotalFile = Space(LOF(FileNum)) Get #FileNum, , TotalFile Close #FileNum Lines = Split(TotalFile, ",,") Set R = ActiveSheet.Cells(2, "A").Resize(UBound(Lines) + 1) R = WorksheetFunction.Transpose(Lines) R.TextToColumns R(1), xlDelimited, xlTextQualifierNone, Comma:=True End Sub -- Rick (MVP - Excel) "KC" wrote in message ... I like this line input + split "Jacob Skaria" wrote in message ... 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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Using comma inside the comma delimited text in Data Validation/Sou | Excel Programming | |||
Import comma delimited text | Excel Discussion (Misc queries) | |||
Import Comma delimited info in a Column | Excel Worksheet Functions | |||
Can an Excel spreadsheet be exported to a comma-delimited import . | Excel Discussion (Misc queries) | |||
I have a Comma delimited text file how do I import in to excel an. | Excel Discussion (Misc queries) |