Can anyone help me please?
I am trying to convert a Hex value into an decimal, i am using a variable so i cannot use:
VB Code:
Cint(&HA&)
is there a quick function to do this?
Printable View
Can anyone help me please?
I am trying to convert a Hex value into an decimal, i am using a variable so i cannot use:
VB Code:
Cint(&HA&)
is there a quick function to do this?
I'm not really sure what you are trying to do.
Hex and decimal are just 2 ways of displaying the contents of your variable. You can't convert the variable from hex to decimal.
I have for example a string:
VB Code:
message
this string contaings "8A"
i want to convert this from a hex representation to a decimal ie
Cint(&H8A&) = 138
What's the variable type?
What's stored in the variable?
If it is a string, containing "&HA" then Cint(variable) will work fine
if it is just "A" then use Cint("&H" & variable)
Thanks Si i think i have been trying to over complicate the problem.
Help! Got the same problem but it wont work when i need to convert this hex value(CB00) It should convert to 51,968 decimal.
Try:
VB Code:
Dim hHex As String Dim dDec As Long hHex = "CB00" dDec = CLng("&H" & hHex) msgbox dDec