conditional formatting to print

C

CV323

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!
 
J

Jim Rech

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!
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top