M
Mota
Hi;
Is there a way to use operators such as "AND" or "OR" or "Between" in a
Select Case statement?
For example,how can we do such a meaning in VBA?
Dim X as Integer
X=800
Select Case X
Case X>0 And X<500 ' This is a wrong Syntax and causes to
"CaseElse"happenes,
' untill we replace it with
"Case Is > 0"
DoSomething.....
Case X>=500 And X<1000
DoSomethingElse.....
Case Else
MsgBox "Wrong Data Entered"
End Select
For now,im doing this thru an If statement after each "Case".Isnt there a
syntax to do limitation on each "Case",without putting an If after it?
Thank you.
Is there a way to use operators such as "AND" or "OR" or "Between" in a
Select Case statement?
For example,how can we do such a meaning in VBA?
Dim X as Integer
X=800
Select Case X
Case X>0 And X<500 ' This is a wrong Syntax and causes to
"CaseElse"happenes,
' untill we replace it with
"Case Is > 0"
DoSomething.....
Case X>=500 And X<1000
DoSomethingElse.....
Case Else
MsgBox "Wrong Data Entered"
End Select
For now,im doing this thru an If statement after each "Case".Isnt there a
syntax to do limitation on each "Case",without putting an If after it?
Thank you.