View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Andre S Andre S is offline
external usenet poster
 
Posts: 1
Default conditional disable functions

Hi all,

In a worksheet, I work with data in a table and the last colomn has a sum
function. that can be a value or 0. Because all rows that ends with sum = 0,
I want to suppress them when I print. Therefore I start a macro suppres_lines
that uses the filterfunction and all rows with value 0 are hidden. I placed
the macro under the Workbook folder

Private Sub Workbook_BeforePrint(Cancel As Boolean)
suppres_lines
End Sub

But it can also be, that under circumstances there is no row in the table at
all. (all rows are 0) Therefore I would have the possibilty to cancel the
printcommand. I tried a lot of things, like Exit sub, but after exiting this
BEFOREprint, the printcommand is still executed. Is there something that
cancels the action that would be taken after a before...(print/save/close)
action?

Andre S