Thanks for the replies. But still I can't understand.
If I run the following code, I receive a "Test passed" message box although the variable is integer and not double.
Code:
Sub test()
Dim test As Integer
test = 1
Select Case test
Case 0.8, 1#, 1.2, 1.6, 2#
MsgBox "Test Passed"
Case Else
End Select
End Sub
i believe so.
But.. see the other numbers. they all have decimals. the
author of the code is only being explicit on the datatype.
you can write 0.8# for 0.8 , but since It Already has decimal,
suffixing it with "#" is rather redundant.
only 1 and 2 are suffxied with # (to clearly emphasized that
all in the list are double values).
See if this helps...
The limits for Long datatype numbers are -2147483648 to 2147483647.
Paste this into a standard module and run it
Code:
Sub NumberTest()
Dim L As Long
L = 2147483646
Debug.Print L + 1
End Sub
You will as expected see 2147483647 in the immediate window.
Now set L=2147483647 & run again. You will get an overflow error and the result is outside the limits
So far, nothing unexpected
Finally enter L =2147483648 and press Enter. Note what happens. Does it make sense to you?
NOTE Using Debug.Print CDbl(L) + 1 will work in all three cases