Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Trying to get rid of duplicate rows, and keep only the latest date/
time group. Currently it gives me the earliest date/time group. I have researched past posts, but they all seem to keep the earliest date. What do I need to change in the code below, or possibly you can suggest a different way of doing it. Thanks. Dim Col As Integer Dim r As Long Dim C As Range Dim N As Long Dim V As Variant Dim Rng As Range Range("A1").Select Application.Calculation = xlCalculationManual Col = ActiveCell.Column If Selection.Rows.Count 1 Then Set Rng = Selection Else: Set Rng = ActiveSheet.UsedRange.Rows End If N = 0 For r = Rng.Rows.Count To 1 Step -1 V = Rng.Cells(r, 1).Value If Application.WorksheetFunction.CountIf _ (Rng.Columns(1), V) 1 Then Rng.Rows(r).EntireRow.Delete N = N + 1 End If Next r |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
delete duplicate rows, keep one | Excel Discussion (Misc queries) | |||
Finding the latest date represented in a group of cells | Excel Discussion (Misc queries) | |||
I want to delete duplicate in one time | Excel Worksheet Functions | |||
Delete duplicate rows | Excel Programming | |||
HELP delete duplicate rows. | Excel Programming |