View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Conditional Formatting

Hi CDotWin,

Try:

Sub Tester()
Dim Rng As Range

Set Rng = Range("A1:d10") '<<<<<<<<<<<<<<<< CHANGE!
With Rng
.FormatConditions.Delete

.FormatConditions.Add Type:=xlExpression, _
Formula1:="=AND(" & Rng(1).Address(0, 0) _
& "=""p"",COUNTIF(" & Rng.Row & ":" _
& Rng.Row & ",""=P"")2)"
.FormatConditions(1).Interior.ColorIndex = 19
End With
End Sub

Change the range to suit your requirements.

---
Regards,
Norman


"CDotWin" wrote in message
...
Hey,

Yes, I would like to do this in VB. What you gave me worked. I'm just

wondering if I can only apply the conditional formatting to the cells that
have the "P" actually in them and not the entire range. I also want to see
if the conditional formatting is true for each row, not really a range of
cells. Each row represents a date and I am trying to see if "P" shows up
more than three times on that date. I hope I'm not confusing you.

Thanks for your help in advance.
--CDotWin--