简体   繁体   中英

VB Excel equivalent of IF x == y or x == z then

IN python I would write:

if x == y or x == z: 
    #do something 

How can I write this in VB for excel?

Here is what I'm actually doing:

lang = Left(objFile.Name, 4)

For Each LangCode In Split("1030,1053,1044,1035", ",")
    #do something

But this incorrectly returns '1033333' as True so Id like to be more explicit.

You would do something like this:

if x=y or x=z then
    'do stuff
end if

And on your for statement

For Each LangCode In Split("1030,1053,1044,1035", ",")
   #do something
next langcode

The end of loops, if statments if not on the same line require an ending statement. I am not sure how it is done in PHP.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM