Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Hiding "0" rows in printing.

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
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.
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Hiding "0" rows in printing.


"Peter Atherton" wrote in message
...
Wahab

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


BeforePrint is not a worksheet event, it has to go in as a workbook event.


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

Sub Before_print()


The correct syntax is

Private Sub Workbook_Before(Cancel As Boolean)



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Hiding "0" rows in printing.

And another try for the syntax :-)
Private Sub Workbook_BeforePrint(Cancel As Boolean)

Frank

Bob Phillips wrote:
"Peter Atherton" wrote in message
...
Wahab

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


BeforePrint is not a worksheet event, it has to go in as a workbook
event.


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

Sub Before_print()


The correct syntax is

Private Sub Workbook_Before(Cancel As Boolean)



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Hiding "0" rows in printing.

Whoops, where did that go?

How embarrassing<vbg

Bob

"Frank Kabel" wrote in message
...
And another try for the syntax :-)
Private Sub Workbook_BeforePrint(Cancel As Boolean)

Frank

Bob





  #6   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Hiding "0" rows in printing.


-----Original Message-----
Whoops, where did that go?

How embarrassing<vbg

Bob

"Frank Kabel" wrote in message
...
And another try for the syntax :-)
Private Sub Workbook_BeforePrint(Cancel As Boolean)

Frank

Bob



.

Thank you very much Peter and Bob.
This work very fine with me, is ther any code that after
printing it will unhide the row?
Or the same thing can I wirte not to print only, like in
lotus when we put || in strating line that line will eject
from printing, thats all no necessity to unhide.
Again thank you very much , this time also I need quick
reply.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
How do display a "+" or "-" sign when hiding columns? DTI Tustin Setting up and Configuration of Excel 1 July 13th 06 01:21 PM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM
2 questions one on list/combo boxes and the other on "atomically" hiding columns or rows. Marc New Users to Excel 1 March 4th 06 05:13 AM


All times are GMT +1. The time now is 12:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"