Dear Excel experts,
I have two cells (G91,G100) on "Sheet2" which are conditionally formatted (highlighting background RGB(201, 243, 240)) when they are empty.
So, when I type text in cell G91, the highlighted background disappears, and when I type no text in formatted cell G100, the highlight still remains in cell G100. However, I do not wish to print the highlighted background in empty cell G100.
The highlights are only used to edit in screen view, so they should not be printed.
I found some code online and altered it, but it does not seem to work. Any suggestions or alternative code on how to make it work?
Code
Sub FixCells()Set Rng = Range("G91,G100")Rng.FormatConditions(1).Delete 'Deletes all C/F from RngActiveSheet.PrintPreviewRng.Select Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=ISBLANK($G$91,$G$100)" Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority With Selection.FormatConditions(1).Interior 'You will need to get the C/F settings from your original set-up and reassign below .PatternColorIndex = xlAutomatic .Color = RGB(201, 243, 240) .TintAndShade = 0 .PatternTintAndShade = 0 End With Selection.FormatConditions(1).StopIfTrue = FalseEnd Sub
[COLOR="#FF0000"]MOD Edit[/COLOR]:
Reposted http://www.ozgrid.com/forum/showthread.php?t=201253