View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Row by Row Comparison & Deletion

Hi Mark,

Am Mon, 11 May 2020 16:38:35 -0700 (PDT) schrieb NoodNutt:

I thought it easier to send you a test file direct so you can see first hand.

I will keep the group updated as to the outcome, when available.


sorry, I didn't read your question with care

Try:

Sub Test()
Dim LRow As Long, i As Long
Dim First As Long, Last As Long

With ActiveSheet
LRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = LRow To 4 Step -1
First = i
Last = Application.CountIfs(.Range("B3:B" & LRow), .Cells(First, "B"), _
.Range("A3:A" & LRow), .Cells(First, "A"))
If Last 1 Then
.Cells(First, "C") = .Cells(First, "C").Offset(-Last + 1)
.Rows(First - 1 & ":" & First - Last + 1).Delete
i = i - Last + 1
End If
Next
End With
End Sub

Regards
Claus B.
--
Windows10
Office 2016