+ Reply to Thread
Results 1 to 5 of 5

Looping through multiple worksheets to remove duplicates

  1. #1
    Registered User
    Join Date
    06-21-2012
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2010
    Posts
    3

    Looping through multiple worksheets to remove duplicates

    I have an excel file that has 50 tabs of data. I need all of the duplicates within EACH of the tabs to be deleted. I used the following code, however it only removed the duplicates on the first tab. Is there a way to create a loop to go through each of the 50 tabs?

    Range("A1:Z21000").RemoveDuplicates Columns:=Array(1, 2, 5, 7, 20, 25), _
    Header:=xlYes

    Thanks!

  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: Looping through multiple worksheets to remove duplicates

    Try this -
    Please Login or Register  to view this content.
    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
    Registered User
    Join Date
    06-21-2012
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Looping through multiple worksheets to remove duplicates

    This is close. This macro has to reside in the workbook in order for it to work. The data I am getting is from another system and is an export so will always be a different workbook. For that reason I have all of my macros in a general Excel file. They all seem to work, but this one does not. Could it be associated to the "thisworkbook.worksheets" line?

    I apologize in advance for the ignorance on my part as I am fairly new to macros.

    Thanks!

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

    Re: Looping through multiple worksheets to remove duplicates

    You could change it to
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-21-2012
    Location
    Phoenix, AZ
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Looping through multiple worksheets to remove duplicates

    Yep! I just figured it out, too!

    Thank you so much for your help!!

    I will mark this solved!

+ 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