+ Reply to Thread
Results 1 to 4 of 4

Sort/Duplicate Help

  1. #1
    Registered User
    Join Date
    01-31-2006
    Posts
    14

    Sort/Duplicate Help

    Hello All,
    This is what I am trying to do. I am new at this and have been trying for a couple of weeks.
    Truck # Date Checked Engine #
    36481 6/28/06 3cs26898
    36498 6/26/06 3cs27391
    36507 7/5/06 3cs27750
    36526 6/26/06 3cs28760
    36526 6/28/06 3cs28760
    36539 6/26/06 3cs28972
    36540 7/5/06 3cs28990
    36550 6/28/06 3cs28983
    36552 6/26/06 3cs28920
    36553 6/28/06 3cs28921
    36558 7/5/06 3cs28595

    I want to sort column A then include B & C (expand selection) I think it says, then check for duplicate Truck #'s and delete or remove the duplicate truck # row.
    Hope this makes sense.
    Any help would be appreicated. Thx in advance
    James

  2. #2
    Tom Ogilvy
    Guest

    Re: Sort/Duplicate Help

    Sub FixData()
    Dim lastrow as Long, i as Long
    Range(A:C).Sort Key1:=Range("A2"), _
    Order1:=xlAscending, _
    Header:=xlGuess, _
    OrderCustom:=1, _
    MatchCase:=False, _
    Orientation:=xlTopToBottom
    lastrow = cells(rows.count,1).End(xlup).Row
    for i = lastrow - 1 to 2 step - 1
    if cells(i,1) = cells(i+1,1) then
    rows(i).Delete
    end if
    Next
    End Sub

    Test it on a copy of your data.

    --
    Regards,
    Tom Ogilvy

    "nascarjc" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hello All,
    > This is what I am trying to do. I am new at this and have been trying
    > for a couple of weeks.
    > Truck # Date Checked Engine #
    > 36481 6/28/06 3cs26898
    > 36498 6/26/06 3cs27391
    > 36507 7/5/06 3cs27750
    > 36526 6/26/06 3cs28760
    > 36526 6/28/06 3cs28760
    > 36539 6/26/06 3cs28972
    > 36540 7/5/06 3cs28990
    > 36550 6/28/06 3cs28983
    > 36552 6/26/06 3cs28920
    > 36553 6/28/06 3cs28921
    > 36558 7/5/06 3cs28595
    >
    > I want to sort column A then include B & C (expand selection) I think
    > it says, then check for duplicate Truck #'s and delete or remove the
    > duplicate truck # row.
    > Hope this makes sense.
    > Any help would be appreicated. Thx in advance
    > James
    >
    >
    > --
    > nascarjc
    > ------------------------------------------------------------------------
    > nascarjc's Profile:
    > http://www.excelforum.com/member.php...o&userid=31002
    > View this thread: http://www.excelforum.com/showthread...hreadid=559639
    >




  3. #3
    Registered User
    Join Date
    01-31-2006
    Posts
    14
    Hi Tom,
    Thanks for the help. I will give it a try and get back to you on how it went.
    James

  4. #4
    Registered User
    Join Date
    01-31-2006
    Posts
    14

    Talking

    Hello Tom,
    I tried the code for the sort and works great and I like how it does it. One thing maybe I should have mentioned before also. When it deletes the duplicates, it erases all the codes I have in it. The page I am sorting and deleting the duplicates, it is copying data from another page.
    What you gave me though is great, I wish I could come up with code that fast. Thanks for your help it is much appreicated. If you need my codes I would gladly put it on also.
    James

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1