I get all screwed around with the logic tables and have to use trial and
error when I get into testing multiple boolean results. Here is a site that
explains where the problem comes from.
http://www.rwc.uc.edu/koehler/comath/21.html
The If statement has to capture the condition so that the result is true to
make the command line execute, even if the result is negative. This means
that you can check to see if it Is, or you can check to see if it is Not,
but you cannot check to see if it is maybe. So when you use the And or the
Or operators in the criteria line of the If statement you need to be aware
of what the logic is doing in evaluating the statement.
"Dan Thompson" <(E-Mail Removed)> wrote in message
news:E24ACD38-68AC-4E03-B1C0-(E-Mail Removed)...
> Hey JLGWhiz
> This is what I am trying to accomplish only I would like to do it in the
> shortest amount of code as possible. I think my code is a little long for
> this macro. here is the code
>
> Sub test()
> Dim one As Boolean, two As Boolean, three As Boolean
> Dim Count As Integer
> one = True
> two = True
> three = True
>
>
> For Count = 1 To 4
> If Count = 1 Then one = False
> If Count = 2 Then two = False
> If Count = 3 Then three = False
> MsgBox "Count # " & Count
> If one = False Or two = False Or three = False Then
> MsgBox "One or more of the 3 conditions are false"
> End If
> If one And two And three = True Then
> MsgBox "All of the 3 conditions are true"
> End If
> one = True
> two = True
> three = True
> Next Count
> End Sub
>
>
> "JLGWhiz" wrote:
>
>> Also:
>>
>> If Not one = True Or Not two = True Or Not three = False Then
>> MsgBox "One or more of the 3 conditions are false"
>> End If
>>
>>
>>
>> "Dan Thompson" <(E-Mail Removed)> wrote in message
>> news:B43C158A-196E-46BC-9B27-(E-Mail Removed)...
>> > 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
>> >
>>
>>
>>