View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Gerard Sanchez Gerard Sanchez is offline
external usenet poster
 
Posts: 46
Default Print Button Macro with Multiple Conditions


Nevermind . . .


"Gerard Sanchez" wrote in message
...

When I compare this post to your earlier one I am wondering exactly what
conditions you want met or (Not met) to fail the print. The code you have
posted here requires all of the conditions set to be met before print
fails.
I thought in your earlier post that any one of the conditions should
cause
failure to print so should it be And or should it be Or?


I think you're right, it should be OR instead, so that if any one of the
condition is true, print macro fails.

I copied and pasted the codes exactly as shown:

Sub PrintWithConditionsTest()

If Range("G59") = "Select Customer" Or _
Range("F64") = "Select User" Or _
Range("F65") = "Not Balanced !" Or _
WorksheetFunction.Count(Range("C61"), Range("C62"), Range("F61"),
Range("F62"), Range("I61"), Range("I62")) = 1 Then

MsgBox "Required information not filled and/or Discrepancy exists!"

Else

Range("A18:I69").PrintOut Copies:=1

End If
End Sub


How come it is still printing even though 2 of the conditions are true,
should it not print and display dialogue box?

G59 = Select Customer
F65 = Not Balanced !