Assign to a button or shape. Based on column A having values
Sub FilterforInvoice()
lr = Cells(Rows.Count, "a").End(xlUp).Row
With Range("a1:a" & lr)
If ActiveSheet.FilterMode Then
.AutoFilter
Else
.AutoFilter Field:=1, Criteria1:=">0", visibleDropDown:=False
ActiveSheet.PrintPreview
End If
End With
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"Sai Krishna" <(E-Mail Removed)> wrote in message
news:82A3FF41-3182-45EF-9D24-(E-Mail Removed)...
> Hi,
>
> I am trying to make an invoice template where rows are used to display
> name
> of product, price etc. The invoice size should automatically be small if
> there are only few rows. In other words, there should not be any blank
> rows
> displayed when there is no item.
>
> I should not manually hide blank spaces, but rather want the invoice to
> shrink to the number of used rows containing positive values and not even
> ""
> values that may be embedded in formulas.
>
> Regards
> sai