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: 11
Default Deleting Duplicate Rows but keeping the most recent.

I am trying to delete duplicate rows in my spreadsheet. Please don't
just send a reference to Cip Pearson's website. I have been there,
found what I needed but I can't get it to work in my instance. Baby
steps and simplistic terms please.

The spreadsheet is a monthly upload that has 19 columns and has
between 500 - 4000. Currently column B is the workorder column this
is duplicated because over the month a workorder could be modified
several times, thus the duplicates.
Column S has the dates of the changes and that is where I would like
to find the most recent and then delete the other two, three sometimes
up to 10 records for each workorder.

Guidance on the use of the following code would be greatly
appreciated. I am new to "code" and would like to become better.



Sub DeleteTheOldies()
Dim RowNdx As Long
For RowNdx = Range("A1").End(xlDown).Row To 2 Step -1
If Cells(RowNdx, "b").Value = Cells(RowNdx - 1, "b").Value Then
If Cells(RowNdx, "s").Value <= Cells(RowNdx - 1, "s").Value
Then
Rows(RowNdx).Delete
Else
Rows(RowNdx - 1).Delete
End If
End If
Next RowNdx
End Sub

Thank you,

Lynn
 
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
Collating Duplicate Rows Keeping all values intact and updating Qu TimP Excel Discussion (Misc queries) 4 September 4th 09 01:48 PM
remove duplicate rows but keeping all columns DC Excel Worksheet Functions 3 June 10th 09 03:10 AM
Keeping duplicate rows Daniell Excel Worksheet Functions 2 April 18th 05 06:56 AM
Deleting duplicate rows.....there's more Fredy Excel Programming 1 June 24th 04 07:04 PM
Deleting Duplicate Rows Connie Excel Programming 3 January 25th 04 09:00 PM


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

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

About Us

"It's about Microsoft Excel"