View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
joel joel is offline
external usenet poster
 
Posts: 9,101
Default convert txt file to excel

Can you show a few more lines of data. I need to know the spacing between
input lines to get the right solution. Is ther any blank rows between the
line of data?

I think this may work

Sub CombineRows()

RowCount = 1
Do While Range("A" & RowCount) < ""
Set LastCol = _
Cells(RowCount, Columns.Count).End(xlToLeft)
Set NewCol = LastCol.Offset(0, 1)
Set NextRowLastCol = _
Cells(RowCount + 1, Columns.Count).End(xlToLeft)
Range(Range("A" & (RowCount + 1)), NextRowLastCol).Copy _
Destination:=NewCol
Rows(RowCount + 1).Delete

RowCount = RowCount + 1
Loop

End Sub


"AccessNewbie" wrote:

I have almost 100 very old text reports that must be converted to excel. My
problem is the reports have been changed (no other way to export them) to run
two separate lines and I need them back to the single line. Ex:

Driver1 Time Hrs Balance Exception
Car Expended Hours Complete Work Defect
Eric 4 3.5 Yes No
15 4 .5 Yes

These lines need to be:
Driver1 Car Time Expended Hrs Hours Complete Balance
Exception Work Defect
Eric 15 4 4 3.5 .5
Yes Yes No

I'm a novice vba/macro person and welcome any suggestions.