J
John
I found programming that finds duplicates and sums up the dups but now I need
to delete the duplicate records. After running this code, I end up with 709
in row 4 that shows as 250 which is what I want but rows 2 and 3 needs
deleted.
COL-A COL-B COL-C COL-D
1239 14 COMPUTER HARDWARE 0
1250 10 COURSES - TRAINING 417
1250 12 COURSES - TRAINING 42
1250 14 COURSES - TRAINING 250
1271 10 CUST. DUTY & NON-RECOV 8333
This is what I have:
Sub Test()
Dim iLastRow As Long
Dim i As Long
iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = 2 To iLastRow
If Cells(i, "A").Value = Cells(i - 1, "A").Value Then
If Cells(i, "A").Value <> Cells(i + 1, "A").Value Then
Cells(i, "E").Value = Application.SumIf( _
Columns(1), Cells(i, "A").Value, Columns(4))
End If
End If
Next i
End Sub
This is what I need to end up with:
COL-A COL-B COL-C COL-D
1239 14 COMPUTER HARDWARE 0
1250 14 COURSES - TRAINING 709
1271 10 CUST. DUTY & NON-RECOV 8333
Can someone help to complete this? Thanks,
to delete the duplicate records. After running this code, I end up with 709
in row 4 that shows as 250 which is what I want but rows 2 and 3 needs
deleted.
COL-A COL-B COL-C COL-D
1239 14 COMPUTER HARDWARE 0
1250 10 COURSES - TRAINING 417
1250 12 COURSES - TRAINING 42
1250 14 COURSES - TRAINING 250
1271 10 CUST. DUTY & NON-RECOV 8333
This is what I have:
Sub Test()
Dim iLastRow As Long
Dim i As Long
iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = 2 To iLastRow
If Cells(i, "A").Value = Cells(i - 1, "A").Value Then
If Cells(i, "A").Value <> Cells(i + 1, "A").Value Then
Cells(i, "E").Value = Application.SumIf( _
Columns(1), Cells(i, "A").Value, Columns(4))
End If
End If
Next i
End Sub
This is what I need to end up with:
COL-A COL-B COL-C COL-D
1239 14 COMPUTER HARDWARE 0
1250 14 COURSES - TRAINING 709
1271 10 CUST. DUTY & NON-RECOV 8333
Can someone help to complete this? Thanks,