Change Tab Color Based On One time Cell Value

Hobolord

Board Regular
Joined
Sep 9, 2015
Messages
64
Hello,

I have Windows 7 and Excel 2010.

Currently I have a macro which checks two reports against each other to ensure all data is in both reports. If they match, J1 has a value of 0 (or very close, like '8.28003976494074E-09') .

There is a tab for each entity, so rather than having to go through every tab to check and see if the value in J1 is '-' (comma style 0) or '0.00' (for the values that round to 0), I'd like to have my macro just turn these tabs green.

I've looked over many articles, but none of them really do what I would need, as many of the codes I've found are their own sub, are placed in the code for the individual sheet, and are able to change the color every time the cell value is changed.

I would just like some code to throw on the end of my existing macro to check one time if the values in J1 for each tab are 0 or round to 0 and if so, then turn the tabs green, and that's it. Is this possible?

Thank you in advance for your time!
 
True! It's more than I had before. I'll continue to play with it and maybe I'll figure it out. Thanks muchly for your help!
 
Upvote 0

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Derp. It was just like you said - an issue with the Activeworkbook. I changed the code and it works like a dream. Thanks!

Code:
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
    With ws
        If Abs(.Range("J1").Value < 0.0001) And Len(.Range("J1").Value) > 0 Then
            .Tab.ColorIndex = 4
        End If
    End With
Next ws
 
Upvote 0

Forum statistics

Threads
1,216,050
Messages
6,128,498
Members
449,455
Latest member
jesski

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top