I need to find any rows where column A and B are the same,
Put the total of the D column in one row and delete the other.
I need to find any rows where column A and B are the same,
Put the total of the D column in one row and delete the other.
See macro1 in attached file... I hope it's what you need.
Regards,
Antonio
Hi,
something like this could help.
Jarek
PHP Code:
Sub sum_qty()
Application.ScreenUpdating = False
row_first = 4
row_last = Range("A" & Rows.Count).End(xlUp).Row
Range("A" & row_first & ":D" & row_last).Sort Key1:=Range("A4"), Order1:=xlAscending, _
Key2:=Range("B4"), Order2:=xlAscending
For i = row_last To row_first + 1 Step -1
If Range("A" & i).Value = Range("A" & i - 1).Value And Range("B" & i).Value = Range("B" & i - 1).Value Then
Range("D" & i - 1).Value = Range("D" & i).Value + Range("D" & i - 1).Value
Rows(i).Delete
End If
Next i
Application.ScreenUpdating = True
End Sub
I think Jarek's one is deleting too many rows.
My stupid work computer wont let me download Antoka05's file but I will check it out when I get home.
Thanks
BTW this was my crude way of doing it (I had to run it several times):
![]()
Please Login or Register to view this content.
Last edited by treva26; 09-07-2007 at 04:13 AM.
This is my macro (so you can try it) but please delete row3 if is empty:
Regards,![]()
Please Login or Register to view this content.
Antonio
Cool, thanks.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks