+ Reply to Thread
Results 1 to 5 of 5

Can't get the "Remove Duplicates" to work in a macro

  1. #1
    Registered User
    Join Date
    09-14-2012
    Location
    Alabama
    MS-Off Ver
    Office for Mac 2011
    Posts
    26

    Can't get the "Remove Duplicates" to work in a macro

    This is what I'm trying to do:

    First: unprotect a worksheet "Owner Information"
    Then: copy C5:K69 from that worksheet
    Then: protect worksheet "Owner Information"
    Then: change to worksheet "Address Book"
    Then: unprotect worksheet "Address Book"
    Then: select A4:I75
    Then: clear all
    Then: select cell A4
    Then: paste the C5:K69 from worksheet "Owner Information" that I have already copied
    Then: swap columns A and B
    Then: format columns to auto-fit
    Then: remove duplicates from rows 6-73 using data from columns A and B (Last name, First name)
    Then: sort rows 6-73 using data from columns A and B
    Then: put border around each cell of remaining rows plus rows 4 and 5
    Then: set protection to lock
    Then: protect work sheet "Address Book"
    Then: save worksheet "Address Book"

    This is the macro I made:

    Please Login or Register  to view this content.
    I would like to do the "Remove Duplicates" routine either before or after the sort with the same range of cells. Any help would be appreciated. I might mention that I am using Excell for Mac 2011 14.2.3 with the OS 10.8.1. I tried using the "fix" for this on your forum but could not get it to work.
    Last edited by arlu1201; 09-14-2012 at 02:21 PM.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Can't get the "Remove Duplicates" to work in a macro

    Welcome to the forum.

    I have added code tags to your post. As per forum rule 3, you need to use them whenever you put any code in your post. Please add them in future. If you need more information on how to use them, check my signature below this post.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Can't get the "Remove Duplicates" to work in a macro

    Your code can be written like this- without the select statements
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    09-14-2012
    Location
    Alabama
    MS-Off Ver
    Office for Mac 2011
    Posts
    26

    Re: Can't get the "Remove Duplicates" to work in a macro

    Thank you, this works but it checks across the entire row for duplicates and I only want the first two columns to determine if the whole row gets deleted.

    Thanks again, that was a big help.

  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Can't get the "Remove Duplicates" to work in a macro

    I have not added anything to your code. I just removed the select statements and made it run a little faster. We still have to correct the remove duplicates part.

+ 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