I was showing you the simplest possible way. When set manually, conditional formatting is applied to all selected cells.
Since this is the VBA forum, you may wish to set the conditional formatting with code. In that case, the following may give you some idea of how to proceed. All you need to do is execute the SetBlankPriceFormat( ) subroutine for every range that contains a price.
====================================================
Code:
Option Explicit
Sub Test()
SetBlankPriceFormat Selection
End Sub
Sub SetBlankPriceFormat(PriceRange As Range)
' Set conditional formatting to all cells in specified range
' to display/print as white text (non-display) when the
' cell named BLANKPRICE is set to 1.
With PriceRange
.FormatConditions.Delete
.FormatConditions.Add Type:=xlExpression, _
Formula1:="=BLANKPRICE=1"
.FormatConditions(1).Font.ColorIndex = 2
End With
End Sub
======================================================
The test example works on the selected cells. If you know specific ranges that have prices, you could use something like this:
=======================================================
Code:
:
:
( your macro )
:
:
SetBlankPriceFormat Range("G2:G15")
SetBlankPriceFormat Range("G18:G30")
:
:
( more of your macro )
:
:
===================================================
Depending on how your macro is written, there may be other
techniques that could be used. E.g. Offset.
If you need more specific assistance, please provide more specific details of the problem you are trying to solve.