+ Reply to Thread
Results 1 to 5 of 5

Create value then rename sheets based on value

  1. #1
    Registered User
    Join Date
    10-11-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Create value then rename sheets based on value

    I have a workbook that is about 60 sheets long that I receive and each sheet is conveniently named Sheet1, Sheet2, etc. and each sheet is formatted identically except for the first two and last one. I'm looking to create a macro that will go through and take the left six characters of the cell A3 and rename the sheet that value.

    I've tried the following, but it doesn't seem to loop properly and the first two sheets and last sheet I have are cover sheets and have no values in A3 and because of that, my macro errors out as well.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Create value then rename sheets based on value

    This takes the first 6 letter of each sheet and name it with that letter.

    Please Login or Register  to view this content.

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Create value then rename sheets based on value

    Hi, ryan.johnson,

    maybe like this (no check for illegal characters or more than 31 characters here):
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Registered User
    Join Date
    10-11-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Create value then rename sheets based on value

    I modified your formula slightly (I accidentally said left earlier, but I'm actually looking for right) and if I remove the first two sheets and the last sheet it works perfectly. I'm looking to have it exclude the first two sheets and the last one, if possible. The number of sheets changes every so often though.

    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Create value then rename sheets based on value

    "I'm looking to have it exclude the first two sheets and the last one, if possible"

    If they have names, you can use names to exclude them as shown with sheet1.

    Please Login or Register  to view this content.
    ' adjust if you want to exclude sheet1 from the loop

    If this is no the option, you can use pattern in the names (Or have unique identifier) to either include or exclude certain names from sheet collection.

+ 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 to Rename sheets based on cell value
    By boll55 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-19-2013, 02:13 PM
  2. Create and rename multiple sheets based on pivot-table field
    By Aerobane in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-10-2013, 02:22 AM
  3. [SOLVED] Code to create new sheet and rename, regardless of any other sheets in workbook
    By csh8428 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-19-2012, 02:22 PM
  4. Replies: 1
    Last Post: 07-23-2010, 02:16 PM
  5. Rename Sheets based on date range
    By Steve in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-03-2005, 11:50 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