ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Conditional Formating a range (https://www.excelbanter.com/excel-programming/342284-conditional-formating-range.html)

Patrick Simonds

Conditional Formating a range
 
Is it possible to do a condional format of a range D123:N123 that would
check for the word No?



Gary Keramidas[_4_]

Conditional Formating a range
 
this is just a macro i recorded while doin the conditional formatting. if
no is entered into this range, the cell will have whute text on red
background

Sub Macro1()
Range("D123:N123").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
Formula1:="=""no"""
Selection.FormatConditions(1).Font.ColorIndex = 2
With Selection.FormatConditions(1).Borders(xlLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.FormatConditions(1).Borders(xlRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.FormatConditions(1).Borders(xlTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.FormatConditions(1).Borders(xlBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.FormatConditions(1).Interior.ColorIndex = 3
Range("D6").Select
End Sub

--


Gary


"Patrick Simonds" wrote in message
...
Is it possible to do a condional format of a range D123:N123 that would
check for the word No?




Patrick Simonds

Conditional Formating a range
 
Thanks for your reply. I found a solution trying different options:

=COUNTIF(D122:R122,"no")



"Gary Keramidas" wrote in message
...
this is just a macro i recorded while doin the conditional formatting. if
no is entered into this range, the cell will have whute text on red
background

Sub Macro1()
Range("D123:N123").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
Formula1:="=""no"""
Selection.FormatConditions(1).Font.ColorIndex = 2
With Selection.FormatConditions(1).Borders(xlLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.FormatConditions(1).Borders(xlRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.FormatConditions(1).Borders(xlTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.FormatConditions(1).Borders(xlBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.FormatConditions(1).Interior.ColorIndex = 3
Range("D6").Select
End Sub

--


Gary


"Patrick Simonds" wrote in message
...
Is it possible to do a condional format of a range D123:N123 that would
check for the word No?







All times are GMT +1. The time now is 05:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com