+ Reply to Thread
Results 1 to 4 of 4

Changing the colour of a tab based on a cell value

Hybrid View

lauz125 Changing the colour of a tab... 05-29-2013, 08:05 AM
dilipandey Re: Changing the colour of a... 05-29-2013, 08:18 AM
lauz125 Re: Changing the colour of a... 05-29-2013, 08:27 AM
dilipandey Re: Changing the colour of a... 05-30-2013, 04:15 AM
  1. #1
    Registered User
    Join Date
    05-29-2013
    Location
    Birmingham
    MS-Off Ver
    Excel 2010
    Posts
    2

    Changing the colour of a tab based on a cell value

    Hi,

    Does anyone have the code I need to use in order to change the colour of a worksheet tab based on a cell value? There are probably about 50 worksheets, and if the value in cell A2 is 0 I would like it to change colour. If it is not zero I would like it to stay as it is, with no colour on the tab. The value in cell A2 will be formula driven.

    Thanks in advance

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Changing the colour of a tab based on a cell value

    Hi Lauz125,

    welcome to the forum.

    Try below code:-

    Sub DILIPandey()
    'tab color change
    For Each Sheet In ActiveWorkbook.Sheets
        Sheet.Select
        If Range("a2").Value = 0 And Range("a2").Value <> "" Then
        ActiveSheet.Tab.Color = 255
        End If
    Next
    End Sub

    Regards,
    DILIPandey
    <click on below * if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), dilipandey@gmail.com

  3. #3
    Registered User
    Join Date
    05-29-2013
    Location
    Birmingham
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Changing the colour of a tab based on a cell value

    Hi,

    Thanks for the reply. It doesn't seem to be making the tabs change colour. Should this work as I'm wondering if I have done something wrong?

  4. #4
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Changing the colour of a tab based on a cell value

    Okay.. can you upload your workbook where you performed this testing ? Thanks.


    Regards,
    DILIPandey
    <click on below * if this helps>

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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