if ... or ... then ?

  • Thread starter Thread starter Max Bialystock
  • Start date Start date
M

Max Bialystock

In vba can you have an if ... then in the format if "x" or "y" then?
 
Max,

You can write your code in a way similar to the following:

If X = something Or Y = something_else Then
' do something
Else
' do something else
End If

If both X and Y are boolean variables (or if they are numeric and you want
to test whether either is not equal to zero), you can simplify the If
statement to

If X Or Y Then


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

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