Using Or in an If statement

  • Thread starter Thread starter Jase
  • Start date Start date
J

Jase

Can I write and If statement saying
"If citeria is matched or_
citeria is matched or_
citeria is matched then
do something

end if"

Can you use or instead of doing a bunch of else if?
 
No I am trying to write it in VBA and I'm not really sure ho wto do that.

Thanks though
 
the answer to yr original question is yes

Sub sth

If cells(1,1).value = 1 or _
cells(1,1).value = 3 or _
cells(1,1).value = 7 Then

cells(1,2).value = "YES"

End if

End Sub
 
The syntax is
IF(logical_test, value_if_true, [value_if_false])

Replace "logical_test" with citeria is matched or citeria is matched or
citeria is matched
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top