But I want the code via a vb script so I can add it to my module t evaluate a specific row or column
Sub Macro3()
'
' Macro3 Macro
'
'
Range("C1:F10").Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=SEARCH(""NAME_"",$C1)=1"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = -0.14996795556505
End With
Selection.FormatConditions(1).StopIfTrue = False
End Sub
Does this do what you want?
If you are using Excel 2010 I don't think you need the ".Select" line.
<font face=Courier New><br><SPAN style="color:#00007F">Sub</SPAN> ApplyCF()<br>****<SPAN style="color:#00007F">With</SPAN> Columns("C")<br>********.Select <SPAN style="color:#007F00">'2007 & earlier</SPAN><br>********.FormatConditions.Delete<br>********.FormatConditions.Add Type:=xlExpression, _<br>************Formula1:="=LEFT(C1,5)=""NAME_"""<br>********.FormatConditions(1).Interior.ColorIndex = 35<br>****<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN><br></FONT>