Hi everyone,
I have this code to prevent printing if cell A1 is empty:
Sub Workbook_BeforePrint(cancel As Boolean)
If Range("A1").Value = "" Then
cancel = True
Else
End If
End Sub
it works fine from "Thisworkbook" module, but I need this code to be on the sheet i want the code to apply to. There are many reasons for this, the main one is that i copy and paste this sheet with code, so i need this print code to "follow" it and work. the problem is, the code wont work from the sheet module. Is there anyway to make it work?
Thanks
I have this code to prevent printing if cell A1 is empty:
Sub Workbook_BeforePrint(cancel As Boolean)
If Range("A1").Value = "" Then
cancel = True
Else
End If
End Sub
it works fine from "Thisworkbook" module, but I need this code to be on the sheet i want the code to apply to. There are many reasons for this, the main one is that i copy and paste this sheet with code, so i need this print code to "follow" it and work. the problem is, the code wont work from the sheet module. Is there anyway to make it work?
Thanks