ultracyclist
Active Member
- Joined
- Oct 6, 2010
- Messages
- 268
- Office Version
-
- 365
- Platform
-
- Windows
I have a very large spreadsheet (>10,000 rows) of data. I did Conditional Formatting based on duplicate values for the serial numbers column (B) and then sorted to “Put Selected Cell Color on top”. Next I did a sort by the Last Scan Date column M (Oldest to New). The date/time format appears as follows
I used the following macro to delete rows with duplicate serial numbers but retain the row that has the newest time stamp. When I run my macro it’s doing the opposite where it deletes rows with the newest time stamp and retains the oldest time stamp.
</SPAN>
I would like to revise the macro to include the following.
Sample data
<TBODY>
</TBODY>
Thanks,
Allen
</SPAN></SPAN>
I used the following macro to delete rows with duplicate serial numbers but retain the row that has the newest time stamp. When I run my macro it’s doing the opposite where it deletes rows with the newest time stamp and retains the oldest time stamp.
</SPAN>
Code:
Sub Test()
'for Macro to Delete Duplicate Rows and Retain Unique Value
Dim LR As Long
LR = ActiveSheet.UsedRange.Rows.Count
Cells.Select
ActiveSheet.Range("$A$1:$M$" & LR).RemoveDuplicates Columns:=2, Header:=xlYes
End Sub
</SPAN></SPAN>
I would like to revise the macro to include the following.
- Delete rows with duplicate serial numbers but retain the row that has the newest time stamp</SPAN>
- Highlight only cells in the range A:M (incl Column Headers) that contain a color palette number of -4142 for cells in column B.</SPAN>
- Do a data sort of the selected cell range based on column L “Last Time Stamp”. Sort by Oldest to Newest.</SPAN>
- Ignore rows that do not contain a serial number value in column B
Sample data
Machine | SerialNumber | LastScanTime |
---|---|---|
XXWZ-2233 | VMware-42 2a 3e 94 | 01/12/2013 09:21:00 |
XXWZ-2233 | VMware-42 2a 3e 94 | 01/12/2013 09:55:00 |
XXWZ-2233 | VMware-42 2a 3e 94 | 01/12/2013 09:55:00 |
XXWZ-2233 | VMware-42 2a 3e 94 | 01/12/2013 10:29:00 |
CSRW-13444 | SGH923030J | 02/20/2013 14:26:00 |
CSRW-13444 | SGH923030J | 02/28/2013 16:15:00 |
04/18/2013 16:54:00 | ||
04/18/2013 17:30:00 |
<TBODY>
</TBODY>
Thanks,
Allen
</SPAN></SPAN>