Code:
b7 = value
b0 = b7-1 min 5 'sets minimum value to 5(change this number to suit)
b1 = b7+1 max 250 'sets maximum value to 250(change this number to suit)
If b12 >= b0 And b12 <= b1 Then
Gosub DoSomething
End If
b0 = b7-1 min 5 will not work as suggested, or as hippy proposed over the full available range (0 to 255), because the line is executed left to right with no precedence and min acts as a limiting fucntion, not the lower of two values.
first we get b7 - 1 so if b7 = 0 then the result is 255 as roll over has occurred as hippy mentioned
next we use min so b0 = 255 min 5 = 255
but this would work:
b0 = b7 min 1 -1
b1 = b7 max 254 +1
Edit:
as mentioned above the min and max are limiting functions. So,
b0 = b7 min 5 will return the higher value of b7 and 5.
and
b1 = b7 max 250 will return the lower value of b7 and 250