davcurnutt
New Member
- Joined
- Mar 31, 2023
- Messages
- 10
- Office Version
- 365
- Platform
- Windows
I have a large spreadsheet and I want to turn tabs green if a value in a specified column exceeds 0.01 and yellow if a value is less than -0.05, otherwise no color. This is my current macro for green and white. How can I add the yellow?
Sub Tabcolor()
'
' Tabcolor Macro
'
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If Application.WorksheetFunction.CountIf(ws.Range("O1:O900"), ">0.01") > 0 Then
ws.Tab.Color = vbGreen
Else
ws.Tab.Color = vbWhite
End If
Next ws
'
End Sub
Sub Tabcolor()
'
' Tabcolor Macro
'
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If Application.WorksheetFunction.CountIf(ws.Range("O1:O900"), ">0.01") > 0 Then
ws.Tab.Color = vbGreen
Else
ws.Tab.Color = vbWhite
End If
Next ws
'
End Sub