+ Reply to Thread
Results 1 to 6 of 6

VBA Prompt rename sheet needs error protection against existing same sheet name

  1. #1
    Registered User
    Join Date
    07-15-2022
    Location
    Delta Canada
    MS-Off Ver
    365
    Posts
    73

    VBA Prompt rename sheet needs error protection against existing same sheet name

    I have VBA that has a inputbox that asks to rename a sheet.
    This works great. It asks for name of sheet to change, and then asks for new name of sheet.
    The problem is it doesn't warm against same sheet name that may already exist.
    Here is the code I have now

    Also, if you hit cancel when trying to input NEW name it gives an runtime error 104 "That name already Taken"
    Is it possible to Loop back to ask for NEW name again or STOP the VBA or a different error, instead of the 10 error?

    Please Login or Register  to view this content.
    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #2 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer
    Last edited by 6StringJazzer; 07-28-2022 at 11:26 AM.

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: VBA Prompt rename sheet needs error protection against existing same sheet name

    Try:
    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Registered User
    Join Date
    07-15-2022
    Location
    Delta Canada
    MS-Off Ver
    365
    Posts
    73

    Re: VBA Prompt rename sheet needs error protection against existing same sheet name

    I think we are very close. If you close the msgbox instead of putting in new name it produces an error.

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: VBA Prompt rename sheet needs error protection against existing same sheet name

    Try:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-15-2022
    Location
    Delta Canada
    MS-Off Ver
    365
    Posts
    73

    Re: VBA Prompt rename sheet needs error protection against existing same sheet name

    Thanks so much works perfectly.

    OK I added a Reputation and marked it as closed.... Am I missing anything?

  6. #6
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: VBA Prompt rename sheet needs error protection against existing same sheet name

    You're missing nothing. You are very welcome and thanks for the rep.

+ 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. Compare of cell values by existing Sheet Protection
    By joe2910 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-12-2019, 12:53 PM
  2. Copy existing sheet and rename from a list on a different sheet
    By me55er in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-02-2017, 05:18 PM
  3. Run-time error '1004: Cannot rename the sheet as another sheet as same name
    By narendrabr in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-03-2014, 11:49 AM
  4. Rename existing worksheets from list on sheet 1
    By DedraMae in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-14-2013, 10:54 AM
  5. Rename existing tabs from list on sheet 1
    By DedraMae in forum Excel General
    Replies: 1
    Last Post: 11-12-2013, 12:26 PM
  6. [SOLVED] Error message:Cannot rename a sheet to the same name as another sheet
    By AB33 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-12-2012, 11:14 AM
  7. Copy and rename a sheet in an existing workbook?
    By robertse in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-09-2010, 02:00 PM

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