MrExcel Publishing
Your One Stop for Excel Tips & Solutions

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?

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
Selection.EntireColumn.Hidden = True
End If

End Sub