Thread: OR statement VB
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default OR statement VB

Max,

In VB

Sub mersible()
If Range("A1").Value = 1 Or Range("A2").Value = 2 Then
MsgBox ("Validated")
Else
MsgBox ("Not Validated")
End If
End Sub

OIr as a worksheet formula:-

=IF(OR(A1=1,A2=2),"Its true","Its not true")

Mike

"Max" wrote:

Hi,

this must be very easy, but I cannot figure it out the right way:

I want an If statement that checks whether one or more cells contain
specific values. Therefore I tried something like:

if or(Sheets(1).Range("K36")16%, Sheets(1).Range("K37")16%) then
BLABLABLA
etc.

However, the OR doesn't work like this, but I cannot figure out how it
should be done!

Thanks for the help!

Max