Sub aaa()
Dim OutSH As Worksheet
Set OutSH = Sheets("Sheet2")
OutSH.Range("A1:I1").Value = Sheets("Sheet1").Range("A1:I1").Value
Sheets("Sheet1").Activate
maxcol = 9
For i = 2 To Cells(Rows.Count, 1).End(xlUp).Row
holder = ""
For j = 1 To 8
holder = holder & Cells(i, j).Value & "|"
Next j
holder = Left(holder, Len(holder) - 1)
Set findit = OutSH.Range("A:A").Find(what:=holder)
If findit Is Nothing Then
OutSH.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Value = holder
Set findit = OutSH.Range("A:A").Find(what:=holder)
End If
OutSH.Cells(findit.Row, WorksheetFunction.Max(9, OutSH.Cells(findit.Row, Columns.Count).End(xlToLeft).Offset(0, 1).Column)).Value = Cells(i, "I").Value
curcol = OutSH.Cells(findit.Row, Columns.Count).End(xlToLeft).Column
If curcol > maxcol Then maxcol = curcol
Next i
OutSH.Activate
Range(Range("A2"), Range("A2").End(xlDown)).Select
Selection.TextToColumns Destination:=Range("A2"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=True, OtherChar _
:="|", FieldInfo:=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, _
1), Array(6, 1), Array(7, 1), Array(8, 1)), TrailingMinusNumbers:=True
For i = 9 To maxcol
Cells(1, i).Value = Cells(1, 9).Value
Next i
End Sub
Bookmarks