对应重复列的数据转成一行
问题:C列相同的,GH两列的内容横向排成一行

Sub Test()
Dim MyRow As Long, MyCol As Long
For MyRow = Cells(Rows.Count, 3).End(xlUp).Row To 2 Step -1
If Cells(MyRow, 3) = Cells(MyRow - 1, 3) Then
MyCol = Cells(MyRow, Columns.Count).End(xlToLeft).Column - 6
Cells(MyRow - 1, 9).Resize(1, MyCol) = Cells(MyRow, 7).Resize(1, MyCol).Value
Cells(MyRow, 3).EntireRow.Delete
End If
Next
End Sub

浙公网安备 33010602011771号