combine data in row then delete the row

alvbnp

Board Regular
Joined
Jun 26, 2006
Messages
180
Sum column E and F if A & C & D is same

Let's say row 2 & 3 meet the criteria, E3 & F3 sum into E2 & F2, then delete row 3, loop till last row.

Thanks for helping.

Code:
Sub test()

RowCount = 1
Do While Range("A" & RowCount) <> ""

If Range("A" & RowCount) = Range("A" & (RowCount + 1)) And _
Range("C" & RowCount) = Range("C" & (RowCount + 1)) And _
Range("D" & RowCount) = Range("D" & (RowCount + 1)) Then

Range("E" & RowCount) = Range("E" & RowCount) + _
Range("E" & (RowCount + 1))
Range("F" & RowCount) = Range("F" & RowCount) + _
Range("F" & (RowCount + 1))
Rows(RowCount + 1).Delete
Else
RowCount = RowCount + 1
End If
Loop

End Sub
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Forum statistics

Threads
1,224,550
Messages
6,179,459
Members
452,915
Latest member
hannnahheileen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top