Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Check for value before printing...


I am looking for a code that will do the following:

Before printing look for...

If D17 0 then D28 must be 0 AND
If F17 0 then F28 must be 0

If one of these conditions is not met then a message box would appear
and cancel printing.

Any help or reference material is appreciated. Thanks!


--
shikamikamoomoo
------------------------------------------------------------------------
shikamikamoomoo's Profile: http://www.excelforum.com/member.php...o&userid=21018
View this thread: http://www.excelforum.com/showthread...hreadid=472205

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Check for value before printing...

shikamikamoomoo,

Put the code below into the codemodule of the Thisworkbook object. Change the sheet name to reflect
the sheet on which you want to base your control of printing.

HTH,
Bernie
MS Excel MVP

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim sh As Worksheet
Set sh = Worksheets("Sheet1")

With sh
If Not (IIf(sh.Range("D17").Value 0, _
IIf(sh.Range("D28").Value 0, True, False), True) And _
(IIf(sh.Range("F17").Value 0, _
IIf(sh.Range("F28").Value 0, True, False), True))) Then
MsgBox "You can't print until they're all greater than zero....."
Cancel = True
Exit Sub
End If
End With
End Sub


"shikamikamoomoo" <shikamikamoomoo.1w6u6e_1128110730.1072@excelfor um-nospam.com wrote in message
news:shikamikamoomoo.1w6u6e_1128110730.1072@excelf orum-nospam.com...

I am looking for a code that will do the following:

Before printing look for...

If D17 0 then D28 must be 0 AND
If F17 0 then F28 must be 0

If one of these conditions is not met then a message box would appear
and cancel printing.

Any help or reference material is appreciated. Thanks!


--
shikamikamoomoo
------------------------------------------------------------------------
shikamikamoomoo's Profile: http://www.excelforum.com/member.php...o&userid=21018
View this thread: http://www.excelforum.com/showthread...hreadid=472205



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Check for value before printing...


Thanks worked great.


--
shikamikamoomoo
------------------------------------------------------------------------
shikamikamoomoo's Profile: http://www.excelforum.com/member.php...o&userid=21018
View this thread: http://www.excelforum.com/showthread...hreadid=472205

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
Format dollar amounts for check printing Bob Phillips Excel Discussion (Misc queries) 0 November 20th 05 12:13 PM
Format dollar amounts for check printing Norman Jones Excel Discussion (Misc queries) 0 November 20th 05 07:23 AM
Check Box Printing Frank Rudd via OfficeKB.com Excel Discussion (Misc queries) 0 June 30th 05 08:05 PM
why do check boxes move when printing excel spreadhseets Simon Jefford Excel Discussion (Misc queries) 3 June 22nd 05 02:04 PM
Check box moves after printing Steve T Excel Discussion (Misc queries) 2 February 16th 05 10:01 PM


All times are GMT +1. The time now is 11:03 AM.

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

About Us

"It's about Microsoft Excel"