Afternoon all,
I've read a bunch of different posts regarding VBA code to change the color of a tab based on a condition but haven't been able to get any of them to work.
I have about 100 different worksheets/tabs that are similiar, and I want to change each individual tab color based on the value of a cell D20 in each tab. If the value is 0 then I want no color the tab. If it is anything but 0 I want it to be green. Cell D20 is a formula that summs a bunch of cells within that tab.
I've tried variations of the code below but it does not seem to do anything. Also tried recalculating the workbook but no luck.
Private Sub Worksheet_Change(ByVal Target As Range)If Range("D20").Value <> 0 Then Me.Tab.ColorIndex = 10Else Me.Tab.ColorIndex = xlColorIndexNoneEnd IfEnd Sub</PRE>Thanks for any help!
I've read a bunch of different posts regarding VBA code to change the color of a tab based on a condition but haven't been able to get any of them to work.
I have about 100 different worksheets/tabs that are similiar, and I want to change each individual tab color based on the value of a cell D20 in each tab. If the value is 0 then I want no color the tab. If it is anything but 0 I want it to be green. Cell D20 is a formula that summs a bunch of cells within that tab.
I've tried variations of the code below but it does not seem to do anything. Also tried recalculating the workbook but no luck.
Private Sub Worksheet_Change(ByVal Target As Range)If Range("D20").Value <> 0 Then Me.Tab.ColorIndex = 10Else Me.Tab.ColorIndex = xlColorIndexNoneEnd IfEnd Sub</PRE>Thanks for any help!