I need a macro that will convert a number from decimal to binary, octave, and Hexadecimal.
and another to convert it back.
This conversion must take place between a variable and user form and back to the variable.
please help
Thanks
I need a macro that will convert a number from decimal to binary, octave, and Hexadecimal.
and another to convert it back.
This conversion must take place between a variable and user form and back to the variable.
please help
Thanks
Search Excel help for the DEC2BIN(), OCT2BIN(), HEX2BIN(), etc. I'm pretty sure all those functions are built into Excel.
In excel on a spread sheet yes and also very easy.
In a macro with NO spreadsheet, that is not so easy to do.
VBA has built in functions which will convert to and from Octal and Hexadecimal numbers.
By Binary I assume you mean a binary representation string of 1s and 0s, because all numbers are binary in a computer.
If you googled the topic you would find a number of example codes already out there, such as:
http://www.devhut.net/2010/06/22/vba...al-and-binary/
Thanks Steven. This helps a lot. Now I must just learn how to use a functions.
It still leaves me with the octave and hexadecimal and my google searches does not seem to be as effective.
You must add "&H" to a Hex string and "&O" to a Oct string. Other than that, it is fairly simple.![]()
Please Login or Register to view this content.
![]()
Please Login or Register to view this content.
I was looking for the easy solution. and it seems that CBase is the answer.
use it as any of the other functions like mid or len
use![]()
Please Login or Register to view this content.
2 for binary
8 for octave
10 for decimal
16 for Hexadecimal
I was mistaken and in my trials inserted a Function called CBase and that is what made it work.
This Function works towards a spreadsheet
So. In other words. I still need help.
To convert number values to and from other base structures to decimal without the aid of a spreadsheet.
Thanks
You need the two functions which I posted earlier (Bin2Dec & Dec2Bin).
And it only works for base 2, 8, 10, & 16.
![]()
Please Login or Register to view this content.
Thanks I will try it not that I have any doubt that it will work once I know what I'm doing.
Thanks again
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks