ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Data validation on print - need code (https://www.excelbanter.com/excel-programming/288067-data-validation-print-need-code.html)

seeker

Data validation on print - need code
 
I need a way to initiate data validation when the user tries to prin
the document.

E.g., cell R1C1 requires input. If user tries to print document
message box appears and tells them to fill in this cell first.

TI

--
Message posted from http://www.ExcelForum.com


seeker

Data validation on print - need code
 
Thank you, just what I needed!


---
Message posted from http://www.ExcelForum.com/


Beto[_3_]

Data validation on print - need code
 
seeker < wrote:

I need a way to initiate data validation when the user tries to print
the document.

E.g., cell R1C1 requires input. If user tries to print document,
message box appears and tells them to fill in this cell first.


There is a Before Print event in the workbook.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If Range("A1")="" Then
Msgbox "You must fill A1 first"
Cancel = True
End If
End Sub

This code of course must be placed in the Workbook module.
Regards,
--
Beto
Reply: Erase between the dot (inclusive) and the @.
Responder: Borra la frase obvia y el punto previo.



All times are GMT +1. The time now is 01:33 PM.

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