ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   conditional formatting to print (https://www.excelbanter.com/excel-programming/388044-conditional-formatting-print.html)

CV323

conditional formatting to print
 
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!


Jim Rech

conditional formatting to print
 
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
"CV323" wrote in message
...
| 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!
|




All times are GMT +1. The time now is 02:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com