display cell only if it contains a value

  • Thread starter Thread starter Sai Krishna
  • Start date Start date
S

Sai Krishna

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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top