+ Reply to Thread
Results 1 to 11 of 11

Macro needed to name excel tabs based on unique cells within each tab

  1. #1
    Registered User
    Join Date
    08-13-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    88

    Macro needed to name excel tabs based on unique cells within each tab

    Hi Everyone,

    I need a macro that will name the tab based on a particular cell but I need this to be automated so it does it for all tabs also.

    Database sheet.xlsx

    Any help would be greatly appreciated!

    An explanation of what I need done can be seen below!

    Cheers

    -----

    1) All experiment tabs to be c2 for their respective cells
    2) In the tab combined sheet the "Expt1" must be labelled to the corresponding new name for the tab.

    E.G

    EXPT 1 gets changed to - Forest Park

    I want it to be in my list as Forest Park in the combined sheet.

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro needed to name excel tabs based on unique cells within each tab

    Hi Ardiko

    Try this Code...place the Code in ThisWorkbook Module
    Please Login or Register  to view this content.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Registered User
    Join Date
    08-13-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    88

    Re: Macro needed to name excel tabs based on unique cells within each tab

    Thanks Jas for the solution but how do I copy it into the workbook? I normally start my Macros with Sub etc so I'm a bit lost.

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro needed to name excel tabs based on unique cells within each tab

    Hi Ardiko

    To insert the Code into your Workbook:
    1. Go into VBA ----> Alt + F11
    2. Click on ThisWorkbook in the Left Hand Panel
    3. Paste the Code in the Right Hand Panel
    4. Exit Vba
    5. Save the File as a Macro Enabled File (.xlsm)
    I've attached your Sample File with the Code embedded.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    08-13-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    88

    Re: Macro needed to name excel tabs based on unique cells within each tab

    Thanks Jas! That's awesome! :D

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro needed to name excel tabs based on unique cells within each tab

    You're welcome...glad I could help. Thanks for the Rep.

    If this resolves your issue please mark your Thread as SOLVED.

    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:
    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

  7. #7
    Registered User
    Join Date
    08-13-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    88

    Re: Macro needed to name excel tabs based on unique cells within each tab

    Cheers Jake - One last thing, is there anyway I can refresh all tabs at once? I have a 140 tabs that need to be converted but i find myself having to open the cell and close it for it to refresh. Any idea how to tackle that?

  8. #8
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro needed to name excel tabs based on unique cells within each tab

    Hi Ardiko

    I don't really know what your asking
    is there anyway I can refresh all tabs at once
    Are you suggesting there's a value in Cell $C$2 in some or all of these 140 sheets and you'd like to update the Sheet Name and the Combined Sheet with that value?

  9. #9
    Registered User
    Join Date
    08-13-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    88

    Re: Macro needed to name excel tabs based on unique cells within each tab

    Hi Jaslake,

    No its working perfect I just want it to be automated. At present I have to click the cell once and then off it and it will change the tab name.
    I want it to change all tabs to Cell XYZ etc automatically which it doesnt do with that script.

  10. #10
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro needed to name excel tabs based on unique cells within each tab

    Hi Ardiko

    I'm still at a bit of loss as to what you're asking. See if this Code answers your question. Place the Code in a General Module.

    You'll need to Comment out or delete the Change Event Code previously provided before running this Code. What the Code does is iterate through the Worksheets. If Cell C2 is not blank the Sheet is renamed to the Value of Cell C2 and SHEET SUMMARY is updated with the Revised Sheet Name.

    I have no idea if this is what you're after...
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    08-13-2012
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    88

    Re: Macro needed to name excel tabs based on unique cells within each tab

    Hi Jas,

    Thanks for all your help and I greatly appreciate it.
    The macro did work and now its bugging again.

    All I need to learn is how to run a macro automatically in several spreadsheets at once.
    The sheet summary is just a function formula so it will do it by itself.

    The new question
    If I wanted to make all the columns a certain width and to run that macro on all tabs, how could I do that? The first macro you gave me changed the tab experiment but I would have to run it on each tab for it to work. Whenever I try to this I always get runtime errors.

    I made a separate thread about this but no one has answered it as of yet.
    Last edited by Ardiko; 09-10-2013 at 01:59 PM.

+ 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 Needed to delete range of cells based on null values in another cell
    By jeffmarsiglio in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-13-2013, 08:22 AM
  2. [SOLVED] Macro - Copy and Combine values in cell and paste it in other cells based on Unique ID
    By haleakala17 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-11-2012, 05:41 PM
  3. [SOLVED] Excel Macro for Cutting Rows based upon Column B into new Tabs in the same workbook
    By paulzzed in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-17-2012, 02:49 AM
  4. [SOLVED] Filtering and generating new tabs based on Unique values based in column
    By amlan009 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-02-2012, 09:40 PM
  5. Replies: 6
    Last Post: 02-01-2012, 05:29 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