VBA – Before Print

Private Sub Workbook_BeforePrint(Cancel As Boolean)

If Cells(4, 3).Value = “” Then

 

MsgBox “Cell C4 must be filled first before “

 

Cancel = True

 

End If

End Sub

========================================

 

Hi everyone,

Above is a VBA code in my excel for not allowing a file to be printed unless a particular cell have filled. Question is, that is for a single particular cell. How if there are more than two particular cells? I need those cells must be filled before the file can be printed. And those cells do not side by side. For example, 1st cell is at C4, 2nd cell is at C7, 3rd cell is at D12.

By: Babah Dayang

Leave a Reply

Your email address will not be published. Required fields are marked *