BlueDevil911
New Member
- Joined
- Jun 1, 2018
- Messages
- 3
I have a workbook that I generate each day from my company. I need to highlight any cells less than 0 in Red. I recorded the macro to do this on one page but when I added in the loop it only works for the sheet I am on and will not go to the next. The data on each sheet changes so I cant select the same range on each sheet. In addition, I would like to turn off show zeros for the workbook in the same macro. I cant just format the 0 to white as some rows are shaded. Thanks!
Code:
Sub CFLessthan0RedALLWS()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
Cells.Select
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, _
Formula1:="=0"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Font
.Color = -16383844
.TintAndShade = 0
End With
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 13551615
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
Range("A1").Select
Next ws
End Sub