大家早上好,下午好:
我在 VBA 中有这样的声明:
Select Case MAAX(Fila, 1)
Case Is <> 5, Is <> 10, Is <> 15, Is <> 20, Is <> 25, Is <> 30, Is <> 35, Is <> 40
Do whatever
End Select
但它不起作用..有什么问题?
最佳答案
如果“不工作”是指您的 CASE
后面的语句总是被执行,您可能误解了该语句的工作原理:
If testexpression matches ANY Case expressionlist expression, the statements following that Case clause are executed ...
几乎不管
MAAX(Fila, 1)
里有什么,它肯定会至少匹配您的一个子句。您需要重写您的 CASE 语句(或使用其他东西),以测试您真正想要的逻辑。
如果你真正想要的是你的测试值不是那些(5、10、...)中的任何一个,你可以做类似的事情
if v<>5 and v<>10 and v<>15 ...
或者,可能
select case v mod 5
case is <>0 'then it is not one of those in your list,
'but it could be greater than 40, so you might have to test for that
关于vba - 使用多个大小写是 <>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48840726/