i need to chek if ORA in in the range ><
...
ORA = .ColumnHeaders(COLONNA).Text
DATA = .ListItems(RIGA).ListSubItems(2).Text
Select Case ORA
'ORA="08:00"
Case >= "07:00" OR <= "09:30"
....
Have error!
note:
ORA is Date dimensioned
SELECT CASE WITH ><
-
- Administrator
- Posts: 78236
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: SELECT CASE WITH ><
You could use
or
Code: Select all
Select Case ORA
Case Is < #7:00:00 AM#
' Skip
Case Is > #9:30:00 AM#
' Skip
Case Else
' ORA is between 7:00 and 9:30
' ...
End Select
Code: Select all
If ORA >= #7:00:00 AM# And ORA <= #9:30:00 AM# Then
' ORA is between 7:00 and 9:30
' ...
End If
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4334
- Joined: 26 Apr 2010, 17:36
Re: SELECT CASE WITH ><
HansV wrote: ↑04 Apr 2022, 09:46You could use
orCode: Select all
Select Case ORA Case Is < #7:00:00 AM# ' Skip Case Is > #9:30:00 AM# ' Skip Case Else ' ORA is between 7:00 and 9:30 ' ... End Select
Code: Select all
If ORA >= #7:00:00 AM# And ORA <= #9:30:00 AM# Then ' ORA is between 7:00 and 9:30 ' ... End If
sorry but i have tree range:
"07:00" "09:30"
"12:00" "14:30"
"19:00" "21:30"
-
- 4StarLounger
- Posts: 536
- Joined: 27 Jun 2021, 10:46
Re: SELECT CASE WITH ><
Assuming that, as you have stated, ORA is Date dimensioned, how about:
Or, if you understand the way Select Case actually works, you can do:
Code: Select all
Select Case ORA
Case "07:00" To "09:30"
Debug.Print "block1"
Case "12:00" To "14:30"
Debug.Print "block2"
Case "19:00" To "21:30"
Debug.Print "block3"
Case Else
Debug.Print "Not one of the blocks of time"
End Select
Code: Select all
Select Case True
Case ORA >= "07:00" And ORA <= "09:30"
Debug.Print "block1"
Case ORA >= "12:00" And ORA <= "14:30"
Debug.Print "block2"
Case ORA >= "19:00" And ORA <= "21:30"
Debug.Print "block3"
Case Else
Debug.Print "Not one of the blocks of time"
End Select
-
- PlatinumLounger
- Posts: 4334
- Joined: 26 Apr 2010, 17:36
Re: SELECT CASE WITH ><
Tks Hans and speack!
Great help!
Great help!