G
Guest
Hi everybody,
I tried assign values using hexidecimal notation in Excel 2003 SP2
and found that &hFFFF is not equal to &h10000 - 1 for LONG integers.
Sample is here:
Sub test()
Const WorkaroundValue As Long = &H10000 - 1
Const WrongValue As Long = &HFFFF
Dim lVal As Long
lVal = &HFFFF
Debug.Print "lVal: " & lVal & " " & Hex(lVal)
If WorkaroundValue = WrongValue Then
Debug.Print "Equal"
Else
Debug.Print "Not Equal: " & WorkaroundValue & "," & WrongValue
Debug.Print "In hex: " & Hex(WorkaroundValue) & "," & Hex(WrongValue)
End If
End Sub
Cheers,
Alex
I tried assign values using hexidecimal notation in Excel 2003 SP2
and found that &hFFFF is not equal to &h10000 - 1 for LONG integers.
Sample is here:
Sub test()
Const WorkaroundValue As Long = &H10000 - 1
Const WrongValue As Long = &HFFFF
Dim lVal As Long
lVal = &HFFFF
Debug.Print "lVal: " & lVal & " " & Hex(lVal)
If WorkaroundValue = WrongValue Then
Debug.Print "Equal"
Else
Debug.Print "Not Equal: " & WorkaroundValue & "," & WrongValue
Debug.Print "In hex: " & Hex(WorkaroundValue) & "," & Hex(WrongValue)
End If
End Sub
Cheers,
Alex