+ Reply to Thread
Results 1 to 6 of 6

Rename worksheets numerically

  1. #1
    Registered User
    Join Date
    07-15-2013
    Location
    Atkinson, Nebraska
    MS-Off Ver
    Excel 2013
    Posts
    10

    Rename worksheets numerically

    I want a button that can rename worksheets based on their name. I am thinking it would need a string compare but I'm not sure how to do that.
    The button should rename anything named "Node (then a number)" or "Sheet(then a number)" and then rename them to "Node (then a number)" based on the order they're placed in the workbook.

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

    Re: Rename worksheets numerically

    Try something like 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.

  3. #3
    Registered User
    Join Date
    07-15-2013
    Location
    Atkinson, Nebraska
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: Rename worksheets numerically

    It is only renaming the sheet* and not the Node*. Also, if I have to reorganize in the future, and the order becomes Node 2, Node 5, Node 1, Node 3, Node 4... will I get a rename error?

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

    Re: Rename worksheets numerically

    Quote Originally Posted by acrawl View Post
    It is only renaming the sheet* and not the Node*. Also, if I have to reorganize in the future, and the order becomes Node 2, Node 5, Node 1, Node 3, Node 4... will I get a rename error?
    It works for me with both "Node" sheets and "Sheet" sheets.

    It won't give you a name error because it renames everything as Nodetemp# then renames them as Node# in their placement order.

  5. #5
    Registered User
    Join Date
    07-15-2013
    Location
    Atkinson, Nebraska
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: Rename worksheets numerically

    Oh you're right! Sorry I had accidentally deleted something in the code. Thank you very much!!!

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

    Re: Rename worksheets numerically

    You're welcome. Glad it works.

+ 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. Add worksheets and rename
    By eriol in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-14-2012, 06:51 AM
  2. Using VBA to add and rename worksheets?
    By AnthonyWB in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-26-2010, 03:28 PM
  3. Rename worksheets with VBA
    By systemx in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-17-2006, 01:00 AM
  4. Rename worksheets
    By Senjaya in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-19-2005, 10:06 AM
  5. How to add worksheets and rename with vba?
    By deko in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-02-2005, 10:11 PM

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