ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   excel print functions (https://www.excelbanter.com/excel-programming/356832-excel-print-functions.html)

jatman

excel print functions
 
i have a template made up and that part works and looks good. i need a macro
that not print unless the value is true. (ex. if the value in cell a1 = bbb,
it will not print indicating an error on the worksheet.

thank you,

jatman

Ron de Bruin

excel print functions
 
You can copy this in the Thisworkbook module for a sheet named Sheet1

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then
Cancel = True
Application.EnableEvents = False
With ActiveSheet
If .Range("A1") = "bbb" Then
.PrintOut
End If
End With
Application.EnableEvents = True
End If
End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl


"jatman" wrote in message ...
i have a template made up and that part works and looks good. i need a macro
that not print unless the value is true. (ex. if the value in cell a1 = bbb,
it will not print indicating an error on the worksheet.

thank you,

jatman





All times are GMT +1. The time now is 10:22 AM.

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