February 2, 200124 yr Hi Does anyone have a calculation up their sleeve that will convert a numeric value into hexadecimal? I've tried myself with a combination of built-in functions, but I'm not very good at math so it never comes out right. Thanks
February 3, 200124 yr Middle("0123456789ABCDEF",1+ Mod(Int(DecNum/16/16/16),16), 1) & Middle("0123456789ABCDEF",1+ Mod(Int(DecNum/16/16),16), 1) & Middle("0123456789ABCDEF",1+ Mod(Int(DecNum/16),16), 1) & Middle("0123456789ABCDEF", 1+Mod(DecNum,16), 1) ... where DecNum is the decimal number you want to convert. This will handle up to 65535 decimal or FFFF hex. If you need more digits, just append more terms on the beginning of the calculation. Add an additional /16 for each one. [This message has been edited by BobWeaver (edited February 02, 2001).]
February 3, 200124 yr Author Bob Thanks a lot. I'd got all the right functions, but couldn't get my punctuation right!
February 5, 200124 yr (((Position("0123456789ABCDEF", Upper(Middle(HexNum, 1, 1)), 1, 1)-1)*16+ Position("0123456789ABCDEF", Upper(Middle(HexNum, 2, 1)), 1, 1)-1)*16+ Position("0123456789ABCDEF", Upper(Middle(HexNum, 3, 1)), 1, 1)-1)*16+ Position("0123456789ABCDEF", Upper(Middle(HexNum, 4, 1)), 1, 1)-1
Create an account or sign in to comment