+ Reply to Thread
Results 1 to 7 of 7

Excel loop - Renaming sheet tabs from range

  1. #1
    Registered User
    Join Date
    07-11-2012
    Location
    Miami, USA
    MS-Off Ver
    Excel 2007
    Posts
    32

    Excel loop - Renaming sheet tabs from range

    Good night everyone,

    I've created a macro that renames a tab but it is very basic.

    Please Login or Register  to view this content.
    I have Sheet1 named as "Pictures". This sheet has a macro button on it and I do not want this sheet name to change. When I click the button, I am looking to have sheet2 and onwards be renamed after the data in range A2:A18. The ranges consist of picture names and I would like the tabs to be names accordingly and stop the loop if there is a blank (no data in the cell).

    Any help would be greatly appreicate.

    Thanks

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Excel loop - Renaming sheet tabs from range

    Something like

    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Registered User
    Join Date
    08-31-2012
    Location
    HCM City, VN
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Excel loop - Renaming sheet tabs from range

    I think you want to change your sheets such as sheet2.name = A2, sheet3.name = A3 and etc, don't you? Here it is your code.

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    07-11-2012
    Location
    Miami, USA
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Excel loop - Renaming sheet tabs from range

    Hi Gervie,

    You are correct. I just want to rename the sheet tabs that I already have existing.

    When I entered your code, nothing change. The msgbox appeared but none of the tabs updated.

    Please help.

  5. #5
    Registered User
    Join Date
    07-11-2012
    Location
    Miami, USA
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Excel loop - Renaming sheet tabs from range

    Actually, I made a error and it worked! Your code worked amazing Gervie. If I wanted to skip naming sheet2 but Sheet3 and so forth, is there a way to adjust the code to do that?

    Thanks so much.

  6. #6
    Registered User
    Join Date
    08-31-2012
    Location
    HCM City, VN
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Excel loop - Renaming sheet tabs from range

    You should change your code to below code. Because if you used my old code, it would be stopped when errors appeared.

    Please Login or Register  to view this content.
    If you want to skip naming the second sheet, you can change it to:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    07-11-2012
    Location
    Miami, USA
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: Excel loop - Renaming sheet tabs from range

    Work great. Thanks so much for the help. I appreciate it

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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