Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hex to Decimal 1

Status
Not open for further replies.

norason

Programmer
Jan 28, 2009
139
US
I have HEX data as a string:

String= "00,01,02,03,04,05,06,07,08,09,0A,0B,0C,0D,ZZ"

That I can read successfully with:

arr(makepoints)=Val(Mid$(Usethis,Start,Qty)

My problem is that I need to translate each point of the string into decimal values. I've tried:

arr(makepoints)=CDec(&H(Val(Mid$(Usethis,Start,Qty))))
and
arr(makepoints)=Val(Cdec($H(Mid$(Usethis,Start,Qty))))

but I get errors.

How can I put the Decimal value of each point in the string into arr(makepoints)?

Thanks,

Gary
 
Something link this....

Code:
    Dim Data As String
    Dim arTemp() As String
    Dim arr() As Long
    Dim i As Long
    
    Data = "00,01,02,03,04,05,06,07,08,09,0A,0B,0C,0D"
    arTemp = Split(Data, ",")
    ReDim arr(UBound(arTemp))
    For i = LBound(arTemp) To UBound(arTemp)
        arr(i) = Val("&h" & arTemp(i))
    Next


-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Thanks a million - that did the trick!

I changed to:

arr(makepoints)=Val("&h" & (Mid$(Usethis,Start,Qty)))

and it worked fine.

Thanks again,

Gary

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top