View Single Post
  #2   Report Post  
Bernie Deitrick
 
Posts: n/a
Default

YB79,

You simply write the format conditions formula for the first cell of the
range, and Excel updates it properly.

With Sh.Range("G2:G" & shLast)
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, _
Formula1:="=AND(H2<"""",G2<TODAY())"
.FormatConditions(1).Font.Bold = True
.FormatConditions(1).Interior.ColorIndex = 3
End With

HTH,
Bernie
MS Excel MVP


"Yogi_Bear_79" wrote in message
...
Need help writing a formula that does this

If IsEmpty(H3) And CurrentCell(G3) <= Today()

The Conditional Format goes in Cell G3. It should check the adjacent cell
H3 for data, if data exists do nothing, if H3 is Empty AND G3 is Less than
or Equal to today, then trip the format.

I'd also like to utilize this code in VBA. Below is a snippet of my code
that applies my current conditional formatting. How would you write the
proper syntax for the statement above so that, every cell in column G is
checking it's adjecent H cell versus all referencing H3?

For Each Sh In ThisWorkbook.Worksheets
shLast = LastRow(Sh)
With Sh.Range("G2:G" & shLast)
.FormatConditions.Add Type:=xlCellValue,

Operator:=xlLessEqual,
Formula1:="=TODAY()"
.FormatConditions(1).Font.Bold = True
.FormatConditions(1).Font.ColorIndex = 3
End With
Next