Link to home
Start Free TrialLog in
Avatar of srlittle
srlittleFlag for United States of America

asked on

Hide Duplicate Records based on TimeStamp

Greetings

I have a data stream in to Excel Spreadsheets (1301, 1302, 1303, etc.) within a single Workbook. I have VBA routines to Delete Duplicate Records but they do not consider the TimeStamps. I need to "Hide" Records and not "Delete"

ColA               ColB               ColC               Cold
1/02/2013      CustA             data               data
1/13/2013      CustA             data               data
1/13/2013      CustB             data               data
1/08/2013      CustA             data               data
1/21/2013      CustB             data               data
1/13/2013      CustC             data               data
1/18/2013      CustB             data               data
1/13/2013      CustD             data               data

I need to "Hide" Records with earlier TimeStamps (ColA) by ColB (Customer)' I wish only to View a Customers Later Record based on TimeStamp (ColA). I must retail all data for a historical record.

ColA               ColB               ColC               Cold
1/13/2013      CustA             data               data
1/21/2013      CustB             data               data
1/13/2013      CustC             data               data
1/13/2013      CustD             data               data

This should run on Active Worksheet

Regards,

Dave
ASKER CERTIFIED SOLUTION
Avatar of Martin Liss
Martin Liss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Note that the above assumes that your data starts in row 2.
Avatar of srlittle

ASKER

Took a while to walk thru your solution. Very nice. I learned a few things. Your code Hides Old Duplicates as expected, however the EntireRow.Hidden property does not allow me to Unhide the Hidden Rows from the Files/Unhide Button (It is grayed Out). However the Right Click "Unhide" works. I need to do this to view Historical Data. Your solution works and I accept with gratitude.

Regards,
Dave
My coding expertise is more centerd on data manipulation. I always enjoy learning more about the power of Workbook/Worksheet Properties and functions.
I'm not familiar with Files/Unhide but here's a companion macro you can use to unhide the rows. Do you know how to assign a shortcut key to the macro?

Sub ShowAll()

Dim lngLastRow As Long
lngLastRow = Range("A65536").End(xlUp).Row

Rows("1:" & lngLastRow).EntireRow.Hidden = False

End Sub

Open in new window

In any case I'm glad I was able to help.

Marty - MVP 2009 to 2013