Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 32
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why am I blocked from copying a file to CD? dogman Excel Discussion (Misc queries) 3 March 14th 07 03:13 PM
Can Outlooked blocked attachment be retrieved Leon Excel Discussion (Misc queries) 2 January 22nd 06 12:40 PM
CD-RW READ Only blocked? Nathan Burkan Excel Discussion (Misc queries) 3 January 12th 06 02:19 PM
virus scanner has blocked this file nishak Excel Discussion (Misc queries) 1 June 24th 05 05:48 PM
Excel printing "shrink-to-fit" cuts off cell data Tim Excel Discussion (Misc queries) 1 January 22nd 05 01:12 AM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"