Mile-O
Back once again...
- Local time
- Today, 03:39
- Joined
- Dec 10, 2002
- Messages
- 11,316
I'm hopeless with ANDs and ORs in conditions when it comes to SELECT CASE and IF...THEN...ELSE statements.
Can anyone help to condense this code?
Can anyone help to condense this code?
Code:
If (datEndDate - datStartDate) = 0 Then
CalculateDaysToResolve = 1
Else
For intCounter = 0 To (datEndDate - datStartDate) Step 1
Select Case datStartDate + intCounter
Case Is = datEaster - 2
' do not increment
Case Is = datEaster + 1
' do not increment
Case Is = datMayDay
' do not increment
Case Is = datSpring
' do not increment
Case Is = datAugust
' do not increment
Case Is = datChristmas
' do not increment
Case Is = datBoxingDay
' do not increment
Case Is = datNewYear
' do not increment
Case Is = datJanuary Then
' do not increment
Case Else
Select Case WeekDay((datStartDate + intCounter))
Case Is = 1 ' Sunday
' do not increment
Case Is = 7 ' Saturday
' do not increment
Case Else
CalculateDaysToResolve = CalculateDaysToResolve + 1
End Select
End Select
Next intCounter
End If
Last edited: