+ Reply to Thread
Results 1 to 3 of 3

Tab colour based on different cell values

  1. #1
    Registered User
    Join Date
    04-21-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    1

    Tab colour based on different cell values

    Hi,

    I have an excel workbook containing more than 100 sheets. Each sheet contains a similar template and has details about different customers.

    I need the tab colour to change from the default colour based on values in different cells.

    For Example,
    Condition 1. If Cell F3 contains data the the tab colour should be Red.
    Condition 2. If Cell F3 and Cell F8 contains data then the tab colour should be Green.

    If both the cells are empty, then default tab colour.

    I tried using VB Code, but was successful in using only one condition. Need assistance in using both the above conditions. The code I have used is

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Range("F8").Value <> 0 Then
    Me.Tab.ColorIndex = 10
    Else
    Me.Tab.ColorIndex = xlColorIndexNone
    End If
    End Sub

    Thanks in advance.
    Subash

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: Tab colour based on different cell values

    Please edit your original thread and add code tags to your VBA code

    For example:

    -----
    AA CodeTags.jpg

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: Tab colour based on different cell values

    You may need to have the option of if f3<>0 and f8=0 as well

    If you place this in the Workbook Module instead of the worksheet module, the code will work for all active sheets.

    How are the two ranges being changed?

    Why haven't you added code tags to your original post like I suggested?

    Please Login or Register  to view this content.

+ 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. Colour shapes based on cell values in a lookup
    By aimone111 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-30-2015, 09:57 PM
  2. count values based on cell colour
    By vijayaragavan in forum Excel General
    Replies: 1
    Last Post: 05-06-2015, 09:05 AM
  3. Replies: 8
    Last Post: 06-29-2014, 10:01 AM
  4. Bar graphs that change colour based on cell values
    By anurajay in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 06-17-2013, 06:45 AM
  5. Replies: 3
    Last Post: 11-09-2011, 12:05 PM
  6. Sum values based on cell colour
    By 2709236 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 06-18-2008, 02:37 PM
  7. Count cell values based on text colour
    By mundo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-22-2008, 09:25 AM

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