Archive of Mr Excel Message Board

Back to Printing in Excel archive index
Back to archive home

Hiding cells when printing in Excel 97
Posted by Bob Johnson on January 07, 2002 10:04 AM
I have a spreadsheet that displays pricing for optional equipment. After selecting the items to include in a quote, I would like to print that quote showing only the items selected. I do not like having to go through and hiding individual rows that do not apply.
Is there any way to say "Do not print this row if a certain cell is blank or zero?" or maybe a macro that would automatically hide a row if the quantity field was blank or zero?

Re: Hiding cells when printing in Excel 97
Posted by Dan on January 07, 2002 12:28 PM
You could try a macro like this which would hide column A if Cell A1 is blank.
Sub HideColumn()
If Range("A1").Value = "" Then
Range("A1").Select
Selection.EntireColumn.Hidden = True
End If
End Sub

This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our
online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.