• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1564
  • Last Modified:

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?
0
bluedragon99
Asked:
bluedragon99
1 Solution
 
venkateshwarrCommented:
you can use Hex() function.
0
 
bluedragon99Author Commented:
Sorry I need Hex to To decimal, had them backwards.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
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
 
elantraCommented:
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
 
bluedragon99Author Commented:
very nice!
0
 
bluedragon99Author Commented:
function in a function hehe
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now