I'm so confused about why the second If
statement works but the first one does not.
The actual result I want is if the user does not enter Peach or Banana or Mango then show the message.
The Or
's in the sentence above makes the most sense. However, if I said "if the user does not enter Peach and Banana and Mango" then show the message - It sounds like you would need to enter all three fruits to show the message which is not the result I'm looking for. But! It's the one that works.
The second If
statement shows the message if none of the correct fruit is entered however, the first statement does not work at all.
Please help clarify.
Column A | Column B |
---|---|
Cell 1 | Apple |
Cell 2 | Orange |
If Item.Value <> "Peach" or Item.Value <> "Banana" or Item.Value <> "Mango" Then
MsgBox "Fruit Not Available"
End If
If Item.Value <> "Peach" And Item.Value <> "Banana" And Item.Value <> "Mango" Then
MsgBox "Fruit Not Available"
End If
I tried both statements but only the second one works and I'm confused why that is.