一个判断数字的问题!!
If alltimel.Caption > = 300 Then
ElseIf alltimel.Caption > = 600 Then
ElseIf alltimel.Caption > = 2000 Then
如果我的 alltimel.caption= 大于300
alltimel.caption=601 这也是判断第一句!
这样只会判断第一句~~ 这个怎么做才正确呢?
[解决办法]
If alltimel.Caption > = 2000 Then
ElseIf alltimel.Caption > = 600 Then
ElseIf alltimel.Caption > = 300 Then
[解决办法]
調轉順序寫啊,或者.
If alltimel.Caption > = 300 and alltimel.Caption <600 Then
ElseIf alltimel.Caption > = 600 and alltimel.Caption <2000 Then
ElseIf alltimel.Caption > = 2000 Then
[解决办法]
Select Case Val(alltimel.Caption)
Case Is > = 2000
MsgBox "> =2000 "
Case Is > = 600
MsgBox "> =600 "
Case Is > = 200
MsgBox "> =200 "
Case Else
MsgBox " <200 "
End Select
如果alltimel.Caption类型为字符型,用Val将alltimel.Caption类型转换为数值型,不然 会出现 "201 "> "2000 "