LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default delete duplicate rows, keep latest date and time group

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
delete duplicate rows, keep one Wasdell Excel Discussion (Misc queries) 1 October 30th 09 12:16 PM
Finding the latest date represented in a group of cells jennifer Excel Discussion (Misc queries) 3 April 18th 07 07:30 PM
I want to delete duplicate in one time [email protected] Excel Worksheet Functions 2 March 15th 07 12:28 PM
Delete duplicate rows Lupe Excel Programming 1 September 12th 06 03:11 PM
HELP delete duplicate rows. Malcolm Excel Programming 2 September 29th 03 11:48 AM


All times are GMT +1. The time now is 02:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"