+ Reply to Thread
Results 1 to 9 of 9

[SOLVED] Need Macro to Hide & Unhide Tabs by Name or Color

  1. #1
    Registered User
    Join Date
    06-30-2015
    Location
    USA
    MS-Off Ver
    2010
    Posts
    15

    [SOLVED] Need Macro to Hide & Unhide Tabs by Name or Color

    Hi There,

    I have a workbook of about 200 tabs, 100 formatted tabs and 100 data tabs (those have "Data" in the title, and are highlighted pink: R:225, G:51, B:153)

    I need to create 2 macros to hide and unhide these tabs.

    Can someone help me with the code for this either hiding/unhiding based on name or color?

    Thanks so much!
    Last edited by lianne.cuscani; 07-01-2015 at 11:17 AM.

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Need Macro to Hide & Unhide Tabs by Name or Color

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    06-30-2015
    Location
    USA
    MS-Off Ver
    2010
    Posts
    15

    Re: Need Macro to Hide & Unhide Tabs by Name or Color

    Thanks a ton! The second code does both the hiding and unhiding, the top code isn't doing anything that I can see - but it works! The only thing is all my pink tabs are now at the end instead of being next to the corresponding red tab. Not a huge deal, but do you know a way of leaving the tabs in the same order?

    Thanks again!

    Lianne

  4. #4
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Need Macro to Hide & Unhide Tabs by Name or Color

    Can you post the workbook (stripped of data, just need to see the tabs)?

  5. #5
    Registered User
    Join Date
    06-30-2015
    Location
    USA
    MS-Off Ver
    2010
    Posts
    15

    Re: Need Macro to Hide & Unhide Tabs by Name or Color

    Here you go!Blank_MC_Report.xlsm

  6. #6
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Need Macro to Hide & Unhide Tabs by Name or Color

    Try these. They work as expected for me. I cannot replicate your issue of the pink tabs being at the end; the order remains the same for me after hiding/unhiding, also as expected. Hiding shouldn't have anything to do with tab ordering. Hopefully that issue is solved with this new code.

    Also of note, a couple of your pink tabs don't have "Data" in them (either as a misspelling or just a "D"). You could remove the Data requirement and just look at color if you want.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    06-30-2015
    Location
    USA
    MS-Off Ver
    2010
    Posts
    15

    Re: Need Macro to Hide & Unhide Tabs by Name or Color

    Thanks! Worked like a charm :-)

  8. #8
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Re: Need Macro to Hide & Unhide Tabs by Name or Color

    Walruss.

    I would like to possibly do something similar. But can you explain how you can determine what the tab color is? Ie, what color would 10040319 be?

  9. #9
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Need Macro to Hide & Unhide Tabs by Name or Color

    lianne:

    Glad to help. Please mark this thread as SOLVED, and any reputation points (the * in the lower left of my posts) is appreciated.

    ptmuldoon:

    Put a Watch on ws.Tab.Color (highlight and hit F9, or Debug -> Watch) and ws.Name, then step through the code (F8). For each worksheet name (ws.Name), you'll be able to see the tab color number.

+ 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. Replies: 3
    Last Post: 02-20-2015, 01:26 PM
  2. Apply a hide/unhide macro to all selected tabs
    By eric_be in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-22-2014, 08:50 AM
  3. [SOLVED] vba code for hide/unhide tabs based on color
    By Allseasons in forum Excel Programming / VBA / Macros
    Replies: 25
    Last Post: 03-17-2014, 04:04 PM
  4. Macro that will hide/unhide sheets based on tab color.
    By Rixonomic in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-11-2012, 02:07 PM
  5. Hide/unhide Tabs by color
    By angeljdiez in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-13-2012, 03:11 AM

Tags for this Thread

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