ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   display cell only if it contains a value (https://www.excelbanter.com/excel-programming/403326-display-cell-only-if-contains-value.html)

Sai Krishna[_2_]

display cell only if it contains a value
 
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

Don Guillett

display cell only if it contains a value
 
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

"Sai Krishna" wrote in message
...
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




All times are GMT +1. The time now is 01:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com