pokeManiac
New Member
- Joined
- Dec 9, 2014
- Messages
- 3
Hi,
I need help with writing the Mod and / functions in VBA in a different way. I read in another thread that these two intrinsically produce results of the Long data type. But I need more than that. This is my convertToHex function which takes in as argument a decimal number:
result = ""
while decNum > 16
result = choose(decNum Mod 16 + 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, "A", "B", "C", "D", "E", "F") & result
decNum = Int(decNum / 16)
wend
convertToHex = choose(decNum + 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, "A", "B", "C", "D", "E", "F") & result
It works fine for a hexadecimal value with seven digits. But when the computation produces an eighth, I get an overflow error.
Help!
I need help with writing the Mod and / functions in VBA in a different way. I read in another thread that these two intrinsically produce results of the Long data type. But I need more than that. This is my convertToHex function which takes in as argument a decimal number:
result = ""
while decNum > 16
result = choose(decNum Mod 16 + 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, "A", "B", "C", "D", "E", "F") & result
decNum = Int(decNum / 16)
wend
convertToHex = choose(decNum + 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, "A", "B", "C", "D", "E", "F") & result
It works fine for a hexadecimal value with seven digits. But when the computation produces an eighth, I get an overflow error.
Help!