Conditional "If Not ... Then" Statement not working properly H
Thank you for your input. However the code you wrote here will not work
for what I am trying to do because any of the variables "one" "two" or
"three" in the final macro will be true sometimes and other times they can be
false. I want to have a conditional statement that will check to see if all
are true and if either of the 3 variables are false then execute my code.
In your example the condition is depending on the variable "three" to be
false when it may be true sometimes.
"JLGWhiz" wrote:
The criteria part of the statement is false, therefor, VBA will not execute
the command line. Try this statement:
If one = True And two = True And three = False Then
MsgBox "One or more of the 3 conditions are false"
End If
"Dan Thompson" wrote in message
...
The following code should pop up a message box but it is not doing so
where
am I going wrong ?
Sub test()
Dim one As Boolean, two As Boolean, three As Boolean
one = True
two = True
three = False
If Not one = True And Not two = True And Not three = False Then
MsgBox "One or more of the 3 conditions are false"
End If
End Sub
Dan Thompson
|