View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter Atherton[_25_] Peter Atherton[_25_] is offline
external usenet poster
 
Posts: 1
Default Hiding "0" rows in printing.

Wahab

If you want this to work on one sheet put it in the sheet
code module (right-click sheet nametab, View code)

put it in the Workbook module to work on more than one
sheet.

Sub Before_print()
Dim i As Long, nr As Long
Dim c, rng As Range
With Sheets("Sheet2")
nr = Application.WorksheetFunction.CountA(Range("A:A"))
For i = 2 To nr
If IsEmpty(Cells(i, 2)) Or Cells(i, 2) = 0 Then
Cells(i, 2).EntireRow.Hidden = True
End If
Next i
End With
End Sub


Peter
-----Original Message-----
Hi
I've small cost sheet which consist of 75 rows and 8
columns. Sheet will look like below:
A B C
Description Code Amount
-------------------------------
Salary 301 5000.00
OT/Bonus 302 0.00
-------------------------------
Total 5000.00

what I Want is in my printout second row i.e. OT/Bonus
which is having "0" Value will hide.
Please give me the better solution.
.