One possible "improved" solution is as follows ...
Code:
Select Case b1
Case Is < 219
timerN = 3
timerAc = 120
timerBc = 60
Case Is < 243
timerN = 2
timerAc = 180
timerBc = 60
Case Is <= 255
timerN = 1
timerAc = 600
timerBc = 180
End Select
That code will do exactly the same job as ...
Code:
If (b1 <= 255 And b1 >= 243) Then
timerN = 1
timerAc = 600
timerBc = 180
End If
If (b1 <= 242 And b1 >= 219) Then
timerN = 2
timerAc = 180
timerBc = 60
End If
If (b1 <= 218 And b1 >= 193) Then
timerN = 3
timerAc = 120
timerBc = 60
End If
BUT, it'll probably compile to half the size, run twice as fast, be more readable, easier to comprehend and definitely far easier to maintain.
Regards,
Trent Jackson
Bookmarks