Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Can printing in excel be blocked until data is in a certain cell?
I would like to have a feature in my worksheet that requires a cell to have a
value entered into it before it is possible to print the page, can this be done with a limited knowledge of Visual Basic programming? If not perhaps a sample piece of code could be posted to achieve the above. I am using Excel 2003. Thankyou |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Can printing in excel be blocked until data is in a certain cell?
If you open the VB Editor, look for your workbook in the project explorer
(usually on the left of the window). Select View, Project Explorer if in doubt Open the tree structure against your workbook name Double-click the ThisWorkbook item - a code pane will open Paste the code below into the Code pane '-------<Snippet Private Sub Workbook_BeforePrint(Cancel As Boolean) If ActiveSheet.Range("A1") < "You may print" Then Cancel = True End If End Sub '-------</Snippet Edit the line beginning "If Activesheet..." This code prevents printing of the active sheet if Cell A1 does not contain "You may print" as the entire cell content. Hope this sets you in the right direction Roger Shaftesbury (UK) "Glen Loftus" <Glen wrote in message ... I would like to have a feature in my worksheet that requires a cell to have a value entered into it before it is possible to print the page, can this be done with a limited knowledge of Visual Basic programming? If not perhaps a sample piece of code could be posted to achieve the above. I am using Excel 2003. Thankyou |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Can printing in excel be blocked until data is in a certain ce
Thank you Roger,
I am absolutely staggered at how 5 lines of code can solve my dilemna. I think you've broken the ice with VB for me. :-) Have a great day. Glen Loftus "Roger Whitehead" wrote: If you open the VB Editor, look for your workbook in the project explorer (usually on the left of the window). Select View, Project Explorer if in doubt Open the tree structure against your workbook name Double-click the ThisWorkbook item - a code pane will open Paste the code below into the Code pane '-------<Snippet Private Sub Workbook_BeforePrint(Cancel As Boolean) If ActiveSheet.Range("A1") < "You may print" Then Cancel = True End If End Sub '-------</Snippet Edit the line beginning "If Activesheet..." This code prevents printing of the active sheet if Cell A1 does not contain "You may print" as the entire cell content. Hope this sets you in the right direction Roger Shaftesbury (UK) "Glen Loftus" <Glen wrote in message ... I would like to have a feature in my worksheet that requires a cell to have a value entered into it before it is possible to print the page, can this be done with a limited knowledge of Visual Basic programming? If not perhaps a sample piece of code could be posted to achieve the above. I am using Excel 2003. Thankyou |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Why am I blocked from copying a file to CD? | Excel Discussion (Misc queries) | |||
Can Outlooked blocked attachment be retrieved | Excel Discussion (Misc queries) | |||
CD-RW READ Only blocked? | Excel Discussion (Misc queries) | |||
virus scanner has blocked this file | Excel Discussion (Misc queries) | |||
Excel printing "shrink-to-fit" cuts off cell data | Excel Discussion (Misc queries) |