Hi
This is based on your example file. It adds a new sheet to take the output called consol
Sub aaa()
Dim DataSH As Worksheet, OutSH As Worksheet
Set DataSH = ActiveSheet
Sheets.Add after:=Sheets(Sheets.Count)
ActiveSheet.Name = "Consol"
Set OutSH = ActiveSheet
DataSH.Activate
OutSH.Range("A1").Value = Range("A1").Value
'get a unique listing of the order ids
Range("A:A").AdvancedFilter Action:=xlFilterCopy, copytorange:=OutSH.Range("A1"), unique:=xlYes
maxcnt = 0
holder = ""
For i = 2 To Cells(Rows.Count, 1).End(xlUp).Row
If Cells(i, 1) <> holder Then
holder = Cells(i, 1)
cntr = 0
End If
Set findit = OutSH.Range("A:A").Find(what:=Cells(i, 1))
Cells(i, 2).Resize(1, 19).Copy Destination:=OutSH.Cells(findit.Row, cntr * 19 + 2)
maxcnt = WorksheetFunction.Max(cntr, maxcnt)
cntr = cntr + 1
Next i
For i = 0 To maxcnt
Range("B1:T1").Copy Destination:=OutSH.Cells(1, i * 19 + 2)
Next i
MsgBox "Done"
End Sub
rylo
Bookmarks