+ Reply to Thread
Results 1 to 4 of 4

VBA to color Excel Tabs based on criteria in a Column

  1. #1
    Registered User
    Join Date
    06-20-2017
    Location
    United States
    MS-Off Ver
    2013 EXCEL
    Posts
    2

    VBA to color Excel Tabs based on criteria in a Column

    Hello. I am on the novice side of novice when it comes to VBA. I believe my issue is simple, but I stumped.

    1) I have an Excel workbook with a 'Summary' tab (unique layout) and multiple 'other' tabs containing the same layout. In each 'other' Tab, in Column T2:T15, I have a formula that creates an "x" whenever a criteria is met.
    2) My goal is to create a MACRO that colors a worksheet TAB "Red" if an "x" is listed on that worksheet anywhere in "T2:T12".

    Here is what I currently have.. I get Syntax Error

    'Color Tabs Red if JON not created
    For Each sht In ThisWorkbook.Worksheets
    If Format(sht.Range(T2:T15) = "x") Then
    sht.Tab.ColorIndex = 255 'RED
    End If
    Next


    Thanks in advance!!!
    Last edited by ChrisRice; 06-20-2017 at 11:39 AM.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: VBA to color Excel Tabs based on criteria in a Column

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    06-20-2017
    Location
    United States
    MS-Off Ver
    2013 EXCEL
    Posts
    2

    Re: VBA to color Excel Tabs based on criteria in a Column

    Excellent. Thank you. I was not sure what the 'Dim sht As Worksheet' was for. I removed that line it it worked great. Thanks again!!

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: VBA to color Excel Tabs based on criteria in a Column

    Quote Originally Posted by ChrisRice View Post
    Excellent. Thank you. I was not sure what the 'Dim sht As Worksheet' was for. I removed that line it it worked great. Thanks again!!
    You're welcome.

    The Dim line declares the variable sht as a worksheet-type variable. It's better if it is included, but it is not required in this case.

+ 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] splitting data into multiple tabs based on column criteria
    By bardobhb in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-02-2014, 02:30 PM
  2. [SOLVED] splitting data into multiple tabs based on column criteria
    By bardobhb in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-26-2014, 11:57 PM
  3. [SOLVED] copy Tabs, based on two criteria in column J and paste values
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-13-2013, 03:46 PM
  4. Color Date Cell in Column based on Criteria
    By rlsublime in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-04-2013, 02:21 PM
  5. Replies: 6
    Last Post: 02-01-2012, 05:29 PM
  6. MACROS: Sort by multiple criteria - Create tabs based off of criteria
    By svineyard in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-21-2009, 10:48 AM
  7. My excel 2003 wont let me fill cells with color or color the tabs.
    By trizog in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 02-23-2005, 01:58 PM

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