VBA Excel: removing duplication in database

Let say there is database in the sheet from row A to row F with some lines that are duplicated. I need to write VBA macros that removes these duplication in data.


Before applying macros :
54.46      54.46      54.46      54.46      1137      5/29/2015 9:30
54.42      54.49      54.38      54.48      196268      5/29/2015 9:31
54.44      54.45      54.39      54.43      29330      5/29/2015 9:32
54.4      54.47      54.38      54.44      30679      5/29/2015 9:33
54.415      54.42      54.36      54.38      25518      5/29/2015 9:34
54.38      54.415      54.34      54.41      39001      5/29/2015 9:35
54.32      54.38      54.3      54.37      54390      5/29/2015 9:36
54.33      54.37      54.32      54.32      29377      5/29/2015 9:37
54.355      54.369      54.32      54.3399      45962      5/29/2015 9:38
54.35      54.37      54.34      54.36      47212      5/29/2015 9:39
54.35      54.37      54.33      54.35      42659      5/29/2015 9:40
54.35      54.365      54.3348      54.35      28713      5/29/2015 9:41

54.33      54.37      54.32      54.32      29377      5/29/2015 9:37
54.355      54.369      54.32      54.3399      45962      5/29/2015 9:38
54.35      54.37      54.34      54.36      47212      5/29/2015 9:39
54.35      54.37      54.33      54.35      42659      5/29/2015 9:40
54.35      54.365      54.3348      54.35      28713      5/29/2015 9:41

54.34      54.38      54.34      54.355      66511      5/29/2015 9:42
54.32      54.37      54.32      54.34      33942      5/29/2015 9:43
54.35      54.355      54.31      54.329      31816      5/29/2015 9:44


After applying macros :

54.46      54.46      54.46      54.46      1137      5/29/2015 9:30
54.42      54.49      54.38      54.48      196268      5/29/2015 9:31
54.44      54.45      54.39      54.43      29330      5/29/2015 9:32
54.4      54.47      54.38      54.44      30679      5/29/2015 9:33
54.415      54.42      54.36      54.38      25518      5/29/2015 9:34
54.38      54.415      54.34      54.41      39001      5/29/2015 9:35
54.32      54.38      54.3      54.37      54390      5/29/2015 9:36
54.33      54.37      54.32      54.32      29377      5/29/2015 9:37
54.355      54.369      54.32      54.3399      45962      5/29/2015 9:38
54.35      54.37      54.34      54.36      47212      5/29/2015 9:39
54.35      54.37      54.33      54.35      42659      5/29/2015 9:40
54.35      54.365      54.3348      54.35      28713      5/29/2015 9:41

54.34      54.38      54.34      54.355      66511      5/29/2015 9:42
54.32      54.37      54.32      54.34      33942      5/29/2015 9:43
54.35      54.355      54.31      54.329      31816      5/29/2015 9:44


Many thanks in advance !
SunnyXAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
Try this macro. It assumes that the data starts in A1. It also sorts the data.

Sub RemoveDupes()
Dim lngLastRow As Long

With ActiveSheet
    lngLastRow = ActiveSheet.UsedRange.Rows.Count
    .Columns("A:A").Select
    .Sort.SortFields.Clear
    .Sort.SortFields.Add Key:=Range("A1"), _
        SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
    With .Sort
        .SetRange Range("A1:F" & lngLastRow)
        .Header = xlNo
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With
   
    .Columns("A:F").Select
    .Range("A1:F" & lngLastRow).RemoveDuplicates Columns:=Array(1, 2, 3, 4, 5, 6) _
        , Header:=xlNo
   
End With

End Sub

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SunnyXAuthor Commented:
Many thx for your help
Martin LissOlder than dirtCommented:
You're welcome Sunny, and I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2015
SunnyXAuthor Commented:
Because this question is is very closely based on what I suggested in http://www.experts-exchange.com/questions/28691096/VBA-Excel-merging-two-txt-files.html, which is still open and in progress, this question can be considered as a duplicate question. The other question contains important details. Duplicate questions are an issue - against the Terms of Use is one of the reasons.
@Qlemo
With all respect, This question is not similar to the other question that you referring to. Yes indeed, this question and the other one have same example but the this question asking about removing duplication and another one asking about merging two files which could be considered like 4 steps action uploading , removing duplication and sorting and important data.
The reason why I open this question was that I didn't receive answer on this 4 steps action that why I decide to divide question on four parts. Now tell me what I should do  in case if I still wanna receive answer on my the other question.
http://www.experts-exchange.com/questions/28691096/VBA-Excel-merging-two-txt-files.html 
Once again, answering on this question fulfill only one fourth what Im trying to accomplish.
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
Your isolated parts are contradicting, and obfuscating the final target. In particular this question's solution uses a sort on the first value, but that violates your "don't change the sequence" condition you stated in the other question. Though, as the question is asked, the solution is valid, so no failure on Martin's side. But I'm convinced it is not useful for you, because you omit the bigger picture.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.