+ Reply to Thread
Results 1 to 5 of 5

Check if Sheet Name exists Then Error or continue Create

  1. #1
    Registered User
    Join Date
    12-17-2014
    Location
    London, UK
    MS-Off Ver
    2016
    Posts
    54

    Check if Sheet Name exists Then Error or continue Create

    Hi All,

    i have the code below which creates a new sheet via data from an inputbox.
    i would like to add something to it so that it checks whether a sheet already exists. if so, an error message to display and then inputbox to run again.

    Please Login or Register  to view this content.
    Thank you.

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Check if Sheet Name exists Then Error or continue Create

    Hi alimsab,

    Try the following function (tested and working):
    Please Login or Register  to view this content.
    Lewis

  3. #3
    Registered User
    Join Date
    12-17-2014
    Location
    London, UK
    MS-Off Ver
    2016
    Posts
    54

    Re: Check if Sheet Name exists Then Error or continue Create

    Thanks LJMetzger.
    Your code appears to name a sheet name already.
    The book I have contains too many sheets so what I'd like is to check allssheet names and display msgbox if it exists at the point the user creates a new sheet via an inputbox and code as above.
    Thanks again.
    Al

  4. #4
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Check if Sheet Name exists Then Error or continue Create

    Your code appears to name a sheet name already.
    He did that as an example for you. Using a little creative deducing you could have arrived at the answer that would have worked in your code
    Please Login or Register  to view this content.
    Since you seem to need a simplistic answer, here is another option
    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Check if Sheet Name exists Then Error or continue Create

    Hi alimsab,

    This one may suit your needs better:
    Please Login or Register  to view this content.
    Lewis

+ 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. [SOLVED] Error Worksheet Exists - need code to continue to next name if it does
    By missit in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-29-2014, 12:10 AM
  2. [SOLVED] Check if folder exists, Create if Not
    By szpt9m in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-05-2014, 04:03 AM
  3. [SOLVED] check if sheet exists, if not then create
    By Armitage2k in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-06-2013, 06:12 AM
  4. [SOLVED] Check if sheet exists and delete it using IF ERROR function in VBA
    By Jardim in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-25-2012, 12:06 PM
  5. Check if folder exists, if not create it
    By mattmac in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-28-2009, 10:17 AM

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