ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Setting up and Configuration of Excel (https://www.excelbanter.com/setting-up-configuration-excel/)
-   -   Check cell contents before print (https://www.excelbanter.com/setting-up-configuration-excel/90496-check-cell-contents-before-print.html)

nobbyknownowt

Check cell contents before print
 
Hello there

I have written a spreadsheet that requires certain information to be entered in certain cells to acheive the desired result.
It will total as it goes along so that if a celll is left blank the result though incorrect would still be printed.
I have a macro button on the sheet to print the sheet.
Is it possible for me to have this button check there is data in cells C1(A date) G1 (text) K1 (list) C2 (text) G2 (text) K2 (text) O2 (list) I11 (num) I13 (num) O8:O16 (num) and G51 (text)

Heres hoping

Cheers
Nobby

Paul B

Check cell contents before print
 
Nobby, you could use something like this,

Sub test()
Dim Cel As Range
For Each Cel In [C1:C2,G1:G2,K1:K2,O2, I11,I13,O8:O13,G51]
If IsEmpty(Cel) Then
Cel.Select
MsgBox "Data Missing", vbExclamation, "Can't Print Without All Data"
Exit Sub
End If
Next Cel

' ****Put your print code here*****

End Sub


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"nobbyknownowt" wrote in message
...

Hello there

I have written a spreadsheet that requires certain information to be
entered in certain cells to acheive the desired result.
It will total as it goes along so that if a celll is left blank the
result though incorrect would still be printed.
I have a macro button on the sheet to print the sheet.
Is it possible for me to have this button check there is data in cells
C1(A date) G1 (text) K1 (list) C2 (text) G2 (text) K2 (text) O2 (list)
I11 (num) I13 (num) O8:O16 (num) and G51 (text)

Heres hoping

Cheers
Nobby


--
nobbyknownowt




nobbyknownowt

Absolutely spot on.
Thanks matey!!



cheers
Nobby

Paul B

Check cell contents before print
 
Your welcome, thanks for the feedback

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"nobbyknownowt" wrote in message
...

Absolutely spot on.
Thanks matey!!



cheers
Nobby


--
nobbyknownowt





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

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