+ Reply to Thread
Results 1 to 4 of 4

Check if sheet from list exists in workbook

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

    Check if sheet from list exists in workbook

    Hi All,

    I have a list as follows -
    1100
    1201
    1301
    1302
    1401
    1402
    1601

    I have worksheets in my workbook as -
    1100
    1201

    I need to check if the worksheet from the list exists in the workbook, if not, create it and rename it as per the list.

    I researched a lot online and on this forum but was not able to get the exact code.

    Appreciate your help !!!
    Last edited by arlu1201; 10-25-2011 at 02:42 PM.

  2. #2
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Check if sheet from list exists in workbook

    Please Login or Register  to view this content.
    Assumes your list starts in cell A1.
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  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: Check if sheet from list exists in workbook

    Thanks for the code Dave. I had tried one on similar lines and i got the same error - Cannot rename sheet as the same name as another sheet....etc.

    The line that gives the error is
    Please Login or Register  to view this content.

  4. #4
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Check if sheet from list exists in workbook

    I'm sorry, there were a couple bugs in there.

    Please Login or Register  to view this content.
    Even though the strings are technically different, a workbook seems to not be able to have a sheet1 and Sheet1 sheet at the same time.
    Also, have to make sure we're not comparing a string against a number.

+ 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