Visual Basic CLng() return problem

I am trying to run CLng() to convert decimal to hex inside one of my functions.  The problem is when clng runs in my function it bumps out of the function.  It will not return to the next line in my function.  Any ideas or better ways to convert dec to hex?
LVL 1
bluedragon99Asked:
Who is Participating?
 
elantraConnect With a Mentor Commented:
Here is a function that will convert Hex -> Dec.  Just pass the function your hex value.  Example:  

MsgBox HexToDec(InputBox("Enter a HEX value:"))

---------------------------------------------------------------------------------------------------

Function HexToDec(HexNumber)
    HexToDec = CLng("&H" & HexNumber)
End Function
0
 
venkateshwarrCommented:
you can use Hex() function.
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
bluedragon99Author Commented:
Sorry I need Hex to To decimal, had them backwards.
0
 
rajaloysiousCommented:
Use the VAL function and i hope that is it all it takes to solve your problem
Good Luck
0
 
vwareCommented:
try
Debug.Print Val("&H" & CStr(DecimalValue))
0
 
avya2kCommented:
what is the error and at which code segment
0
 
Ivan_SkrinjaricCommented:
If you wont long try clng("&H" & cstr(number))
0
 
bluedragon99Author Commented:
very nice!
0
 
bluedragon99Author Commented:
function in a function hehe
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.