简体   繁体   English

VB Excel等效于IF x == y或x == z

[英]VB Excel equivalent of IF x == y or x == z then

IN python I would write: 在python中,我会这样写:

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

How can I write this in VB for excel? 如何在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. 但这会错误地将“ 1033333”返回为True,因此Id希望更加明确。

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. 我不确定如何在PHP中完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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