macro to not print blank value rows in invoice

D

Dave

I have an invoice in Excel for billing my customers with over 100 total items
that I carry in my full inventory
I might only use 25 or so per invoice.
Currently eliminate the blank rows manually so I don't have to print all items
would like a macro to automatically not print any row(item) that has no value
Any help would be appreciated.
 
R

Ron de Bruin

This example test if the whole row is empty.
It test row 1 -20 on the active sheet

Sub test()
Dim a As Long
For a = 1 To 20
If Application.WorksheetFunction.CountA(Rows(a)) = 0 Then _
Rows(a).Hidden = True
Next a
ActiveSheet.PrintPreview
Range("A1:A20").EntireRow.Hidden = False
End Sub
 
Top