conditional formatting to print

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi Everyone,

Following is my code.

Range("F88").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=E88<1"
Selection.FormatConditions(1).Font.ColorIndex = 15
Selection.FormatConditions(1).Interior.ColorIndex = 15

This code is used more than once in the Sub. The preceding code will just
hide that error, but when I print the document, I can see the #NUM in black
instead of nothing at all.

Ideally, I'd like to make an if statement that if E88 is zero, simply shade
the cell, otherwise perform the formula. If not, how can I make it print the
way it looks on screen?

Thanks for your help!
 
When you print in black and white any color based effects are lost. I think
this approach is better:

If Range("E88").Value < 1 Then
Range("F88").NumberFormat = ";;;"
Else
Range("F88").NumberFormat = "#,##0_);(#,##0)"
End If

Change the second number format to what you want if necessary.

--
Jim
| Hi Everyone,
|
| Following is my code.
|
| Range("F88").Select
| Selection.FormatConditions.Delete
| Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=E88<1"
| Selection.FormatConditions(1).Font.ColorIndex = 15
| Selection.FormatConditions(1).Interior.ColorIndex = 15
|
| This code is used more than once in the Sub. The preceding code will just
| hide that error, but when I print the document, I can see the #NUM in
black
| instead of nothing at all.
|
| Ideally, I'd like to make an if statement that if E88 is zero, simply
shade
| the cell, otherwise perform the formula. If not, how can I make it print
the
| way it looks on screen?
|
| Thanks for your help!
|
 
Back
Top