Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Dim i As Integer
Dim dec As Double
Dim mult As Double
Dim dbyte As Double
Dim bytes(8) As Byte
' Largest positive number
bytes(1) = 127
bytes(2) = 255
bytes(3) = 255
bytes(4) = 255
bytes(5) = 255
bytes(6) = 255
bytes(7) = 255
bytes(8) = 255
' Largest negative number
' bytes(1) = 128
' bytes(2) = 0
' bytes(3) = 0
' bytes(4) = 0
' bytes(5) = 0
' bytes(6) = 0
' bytes(7) = 0
' bytes(8) = 0
If (bytes(1) And 128) = 128 Then
bytes(1) = bytes(1) And 127
dec = -2 ^ 63
Else
dec = 0
End If
For i = 1 To 8
mult = 256 ^ (8 - i)
dbyte = bytes(i)
dec = dec + dbyte * mult
Next
Debug.Print Format(dec, "0000000000000000000")
Public Function Hex2Currency(HexCurrency As String) As Currency
Dim s As String
Dim i As Integer
' capture error
On Error GoTo ErrorHandler
SaveErrNum = 0
' intitialise
s = "&H"
' create hex string from each char
For i = 1 To Len(HexCurrency)
' high order nibble
s = s & Hex((Asc(Mid(HexCurrency, i, 1)) And &HF0) / 16)
' low order nibble
s = s & Hex(Asc(Mid(HexCurrency, i, 1)) And &HF)
Next i
' hex to currency
Hex2Currency = CCur(s)
Exit Function
ErrorHandler:
Hex2Currency = 0
SaveErrNum = 1
End Function