Eloise T
Active Member
I have been trying to create (cobble together) a VBA that will reset the 25 Conditional Formats in my 20-tab (currently) workbook so that when the Conditional Formats decide to have a mind of their own, I can simply click on a macro-energized button and everything is back to normal.
21 of the 25 Conditional Formats are similar in part to the following:
Cell Value contains: PNL80
...which allows for other "stuff" to be in the cell besides PNL80...it doesn't have to be only PNL80.
The following example, which implements a formula, includes all the possibilities I need which includes PNL80. Unfortunately, since it's a formula and not simply looking for specific text, it never finds M80, nor P80, nor PNL80.
On the other hand, the following example DOES work since all that's in the cell is REBILLED, or REPAID, or PAID. ...so it works since it's exact.
In the first example, PNL80 et. al. will never be exact. How do I change the VBA code from "exact" to simply "find text" as the first picture shows?
Thank you in advance.
21 of the 25 Conditional Formats are similar in part to the following:
Cell Value contains: PNL80
...which allows for other "stuff" to be in the cell besides PNL80...it doesn't have to be only PNL80.
The following example, which implements a formula, includes all the possibilities I need which includes PNL80. Unfortunately, since it's a formula and not simply looking for specific text, it never finds M80, nor P80, nor PNL80.
Code:
.FormatConditions.Add Type:=xlExpression, Formula1:="=OR($C3=""M80"",$C3=""P80"",$C3=""PNL80"")"
.FormatConditions(1).Font.ColorIndex = 1 'Black
.FormatConditions(1).Interior.ColorIndex = 6 'Light Blue Range =$C$3:$C$5003
Code:
.FormatConditions.Add Type:=xlExpression, Formula1:="=OR($F3=""REBILLED"",$F3=""REPAID"",$F3=""PAID"")"
.FormatConditions(1).Font.ColorIndex = 7 'Magenta
.FormatConditions(1).Interior.ColorIndex = 50 'Green Range =$F$3:$F$5003
In the first example, PNL80 et. al. will never be exact. How do I change the VBA code from "exact" to simply "find text" as the first picture shows?
Thank you in advance.
Last edited: