How to combine the row
From
Name Product Price
A 123 40
A 123 40
A 456 15
A 456 15
A 456 15
To
Name Product Price
A 123 80
A 456 30
Bob Phillips
02-12-2012, 07:08 AM
Public Sub ProcessData()
Dim Lastrow As Long
Dim i As Long
Dim cell As Range
Application.ScreenUpdating = False
With ActiveSheet
Lastrow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = Lastrow - 1 To 2 Step -1
If .Cells(i, "B").Value = .Cells(i + 1, "B").Value Then
.Cells(i, "C").Value = .Cells(i, "C").Value + .Cells(i + 1, "C").Value
.Rows(i + 1).Delete
End If
Next i
End With
Application.ScreenUpdating = True
End Sub
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.