I have a little spreadsheet where i have entered hex codes which represent a value, i know i can use "HEX2BIN" to convert these to binary however i cant get them into a format which i want. The total data string consists of 2 parts a Data and Command component.
Example: Data is 37H converted to binary gives 0110111B i neeed it in this format 1110110
Command 10H gives 10000 but i need it as 0000 1
Command 30H gives 00110000 but i need it as 0000 1100
Command 0179H gives 0000101111001 but i need it as 1001 1110 1000 0
Where the command code is between 0 & 31 this needs to be displayeted as 5bits
Where the command code is between 32 & 255 this needs to be displayeted as 8bits
Where the command code is between 0 & 31 this needs to be displayeted as 13bits
the Data code which is always 7 bits.
So my question is how would i write a VBA code to convert the hex values above, the Data value would always be in column "E" and the comand value in column 'G" each commencing from row "7".
The results from the conversion would be on the same row but in columns "F" and "H" respectively
the second part would be to convert them in reverse from binary to hex bearing in ming the transposition of the bit's.
I cant see anyway to convert this other than using VBA.
Any assistance would be appreciated