+ Reply to Thread
Results 1 to 4 of 4

If Worksheet name exists - then...

  1. #1
    Registered User
    Join Date
    09-21-2021
    Location
    Los Angeles
    MS-Off Ver
    365
    Posts
    87

    If Worksheet name exists - then...

    Please Login or Register  to view this content.


    What I am needing to do is essentially create an If there is already a worksheet named "Format(sdate, "yyyy-mm-dd")" in ob2ws, then to delete that sheet and then create a new one with the name

    How do I do this without disrupting the rest of the code?

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,454

    Re: If Worksheet name exists - then...

    Untested but something like:

    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Valued Forum Contributor
    Join Date
    08-08-2022
    Location
    Buenos Aires
    MS-Off Ver
    Excel 2019
    Posts
    1,777

    Re: If Worksheet name exists - then...

    Hi.
    You don't need to waste time to find out if the sheet exists: just delete it (it exists or not). I mean:

    Please Login or Register  to view this content.
    With the above:
    - If the sheet exists, it is deleted.
    - And if it doesn't exist: Nothing happens!

  4. #4
    Registered User
    Join Date
    09-21-2021
    Location
    Los Angeles
    MS-Off Ver
    365
    Posts
    87

    Re: If Worksheet name exists - then...

    Quote Originally Posted by beyond Excel View Post
    Hi.
    You don't need to waste time to find out if the sheet exists: just delete it (it exists or not). I mean:

    Please Login or Register  to view this content.
    With the above:
    - If the sheet exists, it is deleted.
    - And if it doesn't exist: Nothing happens!
    That is perfect!

    thank you.

+ 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] Worksheet exists Fails when Worksheet is chart
    By Andrew Entee in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-28-2017, 01:50 PM
  2. [SOLVED] If Worksheet Exists
    By ChrisMattock in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-17-2015, 11:16 AM
  3. Check if Worksheet exists and Insert Worksheet
    By ddanmcgrew in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-27-2012, 03:19 PM
  4. worksheet exists or not
    By skvabbili in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-04-2006, 05:50 PM
  5. Worksheet exists
    By Kaval in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-27-2006, 04:55 AM
  6. check if worksheet exists
    By Ian in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 09-06-2005, 10:05 PM
  7. check if worksheet exists
    By joeeng in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 04:05 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