John Davies
John Davies

Reputation: 27

Prevent sheet from printing unless certain cell is not blank

Is it possible to prevent a spreadsheet from printing if a certain cell eg. F23 in the sheet is blank and get a pop up message to state that the cell needs to be filled in. Please advise how to do this. Thanks in advance for any help.

Upvotes: 0

Views: 4283

Answers (1)

basodre
basodre

Reputation: 5770

The workbook object has a BeforePrint event. Access it from the ThisWorkbook code. You would enter code such as below:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
    If Sheets("Sheet1").Range("F23").Value = "" Then
        Cancel = True
        MsgBox ("Please populate F23")
    End If
End Sub

Upvotes: 1

Related Questions