I have a macro that highlights specific cells using conditional formatting. For some reason it highlights cells without text too. As a workaround I've made it so the just makes the text in the cells red. I was hoping to then add another macro which highlights cells that have red font/text, that way empty cells aren't highlighted like before.
This code makes specific cells bold:
Sub Highlight()
'
' Highlight good values
Application.ScreenUpdating = False
Dim ws As Worksheet, LC As Long
For Each ws In ActiveWorkbook.Worksheets
LC = ws.Cells(18, ws.Columns.Count).End(xlToLeft).Column
With ws.Range(ws.Cells(18, 3), ws.Cells(79, LC))
.FormatConditions.Add Type:=xlCellValue, Operator:=xlNotBetween, _
Formula1:="=$C18", Formula2:="=$D18"
.FormatConditions(Range(ws.Cells(18, 3), ws.Cells(79, LC)).FormatConditions.Count).SetFirstPriority
With .FormatConditions(1).Font
.Bold = True
.Color = vbRed
.TintAndShade = 0
End With
End With
Next ws
Application.ScreenUpdating = True
End Sub
This code attempted to highlight cells with red font but it doesn't change the cells colour - it doesn't work
Sub cell_red()
Dim ws As Worksheet, LC As Long
For Each ws In ActiveWorkbook.Worksheets
LC = ws.Cells(18, ws.Columns.Count).End(xlToLeft).Column
For Each cell In ws.Range(ws.Cells(18, 3), ws.Cells(79, LC))
If cell.Font.Color = vbRed Then
cell.Interior.ColorIndex = 44
End If
Next
Next ws
End Sub
This may help:
https://answers.microsoft.com/en-us/msoffice/forum/all/conditional-formatting-ignoring-blank-cells/719f087c-5e30-4830-9b7d-0b93cffad357
not sure how to incorporate it though
If cell.DisplayFormat.Font.Color = vbRed Then
docs.microsoft.com/en-us/office/vba/api/… You need to use DisplayFormat if what you're looking for is applied via conditional formatting. – Tim Williams