新建From1(窗体),新建Command1(按钮CommandButton),代码:
Private Sub Command1_Click()
Dim bytesTotal&
bytesTotal = 2
Select Case bytesTotal
Case Is = 1
Debug.Print "=1"
GoTo hOut
Case Is <> 2 '不会运行
Debug.Print "<>2"
GoTo hOut
Case Is <= 20
Debug.Print "<=20"
GoTo hOut
Case Is > 100
Debug.Print ">100"
GoTo hOut
End Select
Debug.Print "hello"
hOut:
End Sub
运行结果:
<=20
可以运行<,<=,=,>,>=运算符,不能使用<>。