+ Reply to Thread
Results 1 to 4 of 4

Checking for duplicate sheet names

  1. #1
    Forum Contributor
    Join Date
    05-26-2004
    Location
    Halifax, UK
    MS-Off Ver
    Office 2016
    Posts
    260

    Checking for duplicate sheet names

    I have a process at work which involves importing a large number of worksheets from several workbooks in to one workbook (the master workbook). Most of the worksheet names are just numbers (integers) and should be unique. However in some cases there are duplicates, so for instance the number 100 might appear twice, so when I import it for the second time it appears as 100(2) since I can't have two worksheets with the same name.

    I'd like some help writing a macro which checks worksheet names and can tell me if this has happened. I think it would work if the macro just looked for a bracket at the end of the worksheet name since a bracket should only be present if there was a duplicate name.

    In English the code should do something like:

    Obtain the next worksheet name
    Check whether this ends in a bracket
    If it does, record the name on the current worksheet (using xlup or something similar)
    If not then move on to the next worksheet and check to see if the name ends with a bracket
    Repeat until all worksheets have been assessed

    Easy to state but I'm having problems getting it to work (not even sure how to start to be honest!)

    Any help greatly appreciated. :-)

    Rob
    Last edited by TheRobsterUK; 05-23-2014 at 06:35 AM.

  2. #2
    Forum Contributor
    Join Date
    06-24-2005
    Location
    excelliot.com
    MS-Off Ver
    2007
    Posts
    325

    Thumbs up Re: Checking for duplicate sheet names

    Check this...


    Option Explicit

    Please Login or Register  to view this content.
    you will get duplicate sheets name on active sheet, beginning cell A1.

    Cheers!!

  3. #3
    Valued Forum Contributor
    Join Date
    03-22-2013
    Location
    Australia,NSW, Wirrimbi
    MS-Off Ver
    Excel 2013
    Posts
    1,057

    Re: Checking for duplicate sheet names

    Hi..

    Here's another..

    Please Login or Register  to view this content.
    Only tiny adaptation needed to the code found here:
    http://www.excelforum.com/excel-prog...-in-array.html

  4. #4
    Forum Contributor
    Join Date
    05-26-2004
    Location
    Halifax, UK
    MS-Off Ver
    Office 2016
    Posts
    260

    Re: Checking for duplicate sheet names

    Hi guys,

    Thanks for the replies. This was also suggested by someone else, which also works:

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Nested For Loop checking for Duplicate Names
    By CoderColby in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-20-2013, 04:17 AM
  2. Finding Duplicate Names in Excel Sheet
    By aquwap in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 03-02-2013, 12:56 PM
  3. Replies: 11
    Last Post: 10-21-2012, 01:40 AM
  4. Replies: 1
    Last Post: 12-10-2010, 09:15 PM
  5. Duplicate a sheet onto a new one with customised column names
    By marsulein in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-18-2008, 11:53 PM

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