+ Reply to Thread
Results 1 to 11 of 11

Rename Sheet Based on List from Another Sheet

  1. #1
    Registered User
    Join Date
    02-07-2012
    Location
    Washington State
    MS-Off Ver
    Excel 2016
    Posts
    13

    Rename Sheet Based on List from Another Sheet

    Hello All,

    I need to write a macro that will create a new sheet and name that sheet based on a list from another sheet.

    Sheet1 range A1:A250 have product names, range B1:B250 have codes that match those product names. I will have a schematic (new sheet) for each product name and code in the workbook. When the user creates the new schematic for the next product, I'd like the sheet name to be "product name + product code".

    Is there a way I can get the result I need?

    Thank you for all the help!

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Rename Sheet Based on List from Another Sheet

    What is supposed to trigger the creation of the new sheet? Or do you just want a macro that makes 250 new sheets with the desired name?
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Registered User
    Join Date
    02-07-2012
    Location
    Washington State
    MS-Off Ver
    Excel 2016
    Posts
    13

    Re: Rename Sheet Based on List from Another Sheet

    The user will trigger the change by clicking a button that says "Create New Schematic" which we already have built, but need the renaming feature added in. And the user only needs to create 1 sheet at a time because the result of the schematic will effect inventory for the next schematic created.

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Rename Sheet Based on List from Another Sheet

    Assuming you have a variable "myRow" that identifies the row for the part:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-07-2012
    Location
    Washington State
    MS-Off Ver
    Excel 2016
    Posts
    13

    Re: Rename Sheet Based on List from Another Sheet

    No I do not have a variable "myRow" that identifies the row. I guess I need to define myRow to be the next row in the list. How do I get that accomplished?

    Could it reference off the current schematic back to the list?

  6. #6
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Rename Sheet Based on List from Another Sheet

    that depends on what your schematic is... if the schematic sheet has the part name and or number, we may not even need to use the sheet1 values to name the new sheet...

    if you are looking for help integrating it into existing code, can you provide the code you are working with? We need to have something that lets the code know what line to refer to on your Sheet with part numbers and names, if we are going to use it. "Next" row in the list is a problem if you don't do all the work in one shot, because the code would not know where you left off yesterday, if you re-open the workbook today.

  7. #7
    Registered User
    Join Date
    02-07-2012
    Location
    Washington State
    MS-Off Ver
    Excel 2016
    Posts
    13

    Re: Rename Sheet Based on List from Another Sheet

    Sent you a pm

  8. #8
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Rename Sheet Based on List from Another Sheet

    Got it, have to do a few things but will review it as soon as I can and see what we can do or need to add...

  9. #9
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Rename Sheet Based on List from Another Sheet

    magneto... anywhere near the start of your new schematic code put this code...

    Please Login or Register  to view this content.
    That should give you the values for Product Name and Code# for the row below the one that relates to the "Current Schematic" meaning the one where you click the button at the time.
    I assume with those variables, you will be able to do the code for filling A6 and I5 and rename the sheet?

    You may want to do some additional coding so that a message comes up if the variables are still empty after the for k loop has run.. since that means there was no match for the name/code combination, or it was working off the last row already.

  10. #10
    Registered User
    Join Date
    02-07-2012
    Location
    Washington State
    MS-Off Ver
    Excel 2016
    Posts
    13

    Re: Rename Sheet Based on List from Another Sheet

    Arkadi,

    Thank you so much for the help. I've applied the code and it works perfectly! Exactly what I was needing. I am going to write up a message box as you suggested.

    Rep point added. Mods, please mark this as [SOLVED].





    Quote Originally Posted by Arkadi View Post
    magneto... anywhere near the start of your new schematic code put this code...

    Please Login or Register  to view this content.
    That should give you the values for Product Name and Code# for the row below the one that relates to the "Current Schematic" meaning the one where you click the button at the time.
    I assume with those variables, you will be able to do the code for filling A6 and I5 and rename the sheet?

    You may want to do some additional coding so that a message comes up if the variables are still empty after the for k loop has run.. since that means there was no match for the name/code combination, or it was working off the last row already.

  11. #11
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059
    Magneto,
    Im glad it worked out
    It is up to you as thread initiator to mark it as solved.

+ 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. [SOLVED] Copy Template Sheet and rename the new sheets based on a list in another sheet
    By SaadKiji in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-05-2016, 11:47 AM
  2. Create A Copy To A New Sheet & Rename Sheet Based on Cell Value
    By delicard in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 07-25-2013, 08:56 PM
  3. Create a New Sheet & Rename it Based on Cell Value on Another Sheet
    By delicard in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-25-2013, 04:48 PM
  4. [SOLVED] Rename each sheet based on a piece of data on that sheet
    By higginmi in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-02-2013, 12:26 PM
  5. Rename sheet based on date in sheet 1, row A
    By akderitend in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 04-23-2013, 04:00 PM
  6. [SOLVED] Copy a sheet (from template) to a new sheet, and rename (based on cell value)
    By Siglen in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-30-2012, 10:19 AM
  7. How rename sheet tabs based on the list on cells?
    By gkeith in forum Excel General
    Replies: 1
    Last Post: 07-23-2010, 02:30 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