+ Reply to Thread
Results 1 to 7 of 7

Error Worksheet Exists - need code to continue to next name if it does

  1. #1
    Registered User
    Join Date
    10-13-2010
    Location
    Colorado Springs, CO
    MS-Off Ver
    Excel 2010
    Posts
    55

    Error Worksheet Exists - need code to continue to next name if it does

    Hi,

    I have the following code that is used to generate worksheets automatically from a listing of names on the "Master Provider List". It works perfectly, but I have found that sometimes I need to add more names to the list. I need the code to look at the list and if the worksheet related to the name already exists, continue on to the next name and create the worksheet. I have never trapped an error before, so not sure how to add that to my code.
    Please Login or Register  to view this content.

    Thanks so much in advance

    C
    Last edited by missit; 03-28-2014 at 06:08 PM. Reason: Fixed so code shows correctly.

  2. #2
    Registered User
    Join Date
    03-19-2014
    Location
    India
    MS-Off Ver
    Excel & VBA - 2007 & 2010
    Posts
    60

    Re: Error Worksheet Exists - need code to continue to next name if it does

    Hi,

    First of all, please input the code in the
    Please Login or Register  to view this content.
    selection box.

    And You can try
    Please Login or Register  to view this content.
    for this

    Thanks!
    Moinuddin Shaikh

    If you like my Response:
    1. Show appreciation to those who have helped you by clicking below their posts.
    2. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    Appreciate someone towards their career path is better than saying Thanks!
    -Moin

  3. #3
    Registered User
    Join Date
    10-13-2010
    Location
    Colorado Springs, CO
    MS-Off Ver
    Excel 2010
    Posts
    55

    Re: Error Worksheet Exists - need code to continue to next name if it does

    thanks for the quick response, where to I put that?

    I can figure out how to use code, but not good at writing it or adding to it. Still novice in that area.



    C

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Error Worksheet Exists - need code to continue to next name if it does

    Using On Error Resume Next would ignore worksheet naming errors, but it would also leave you with un-named copies of your template worksheet.

    Try this...

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  5. #5
    Registered User
    Join Date
    10-13-2010
    Location
    Colorado Springs, CO
    MS-Off Ver
    Excel 2010
    Posts
    55

    Re: Error Worksheet Exists - need code to continue to next name if it does

    Hi,

    When I try this code, it adds an additional copy of the Audittemp worksheet and changes the name of the existing worksheet. Thanks for trying, but what I need is to have a listing of names on Master Provider List and have it automatically copy the AuditTemp and rename that sheet with one of the names on the Master Provider List. thanks for the help.

  6. #6
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Error Worksheet Exists - need code to continue to next name if it does

    It worlked for me.

    Try this...

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    10-13-2010
    Location
    Colorado Springs, CO
    MS-Off Ver
    Excel 2010
    Posts
    55

    Re: Error Worksheet Exists - need code to continue to next name if it does

    Hi,

    That worked !!!! Thank you so much.

+ 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. Macro code to continue iterating if error.
    By sid9221 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-23-2013, 03:39 PM
  2. [SOLVED] IF Exists or on Error Then - Skip Code- How to write code?
    By Jack7774 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-22-2013, 06:45 PM
  3. [SOLVED] changing cell on active sheet does not cause code to continue - No error codes either
    By SoteriaLive in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 10-01-2012, 11:21 AM
  4. VBA Code to continue in Update Links error message
    By dcgrove in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-21-2011, 03:53 PM
  5. Code error, highlight error, continue to RUN
    By JohnSeito in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-07-2008, 01:29 AM

Tags for this Thread

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