View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Conditional Formatting via VBA in Excel 2007

With Selection
.FormatConditions.Add Type:=xlTextString, _
String:="apple", _
TextOperator:=xlBeginsWith
.FormatConditions(Selection.FormatConditions.Count ).SetFirstPriority
With .FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
End With
.FormatConditions(1).StopIfTrue = False
End With


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"MrWinelover" wrote in message
...
New since version 2007 of Excel is the posibility to have conditional
formatting based on cells with specific text beginning with some
predifined
text.
This is done by selecting Conditional Formatting (Home tab) Manage
rules... Select "New Rule..." in the "Conditional Formatting Rules
Manager"
window. In the "Newt Formatting Rule" windows choose the rule type "Format
only cell that contain" and edit the rule description by choosing
"Specific
Text" in the left drop-dowm box and "beginning with" in the right
drop-down
box. Give the text to check on in the textfield and click "OK"

Now the same conditional Formatting should be added via VBA but here's my
problem. It seems there is no information on the internet already.

Can someone help me further?
--
MrWinelover...