Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() -----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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
change "true" and "false" to "availble" and "out of stock" | Excel Worksheet Functions | |||
How do display a "+" or "-" sign when hiding columns? | Setting up and Configuration of Excel | |||
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next | New Users to Excel | |||
2 questions one on list/combo boxes and the other on "atomically" hiding columns or rows. | New Users to Excel |