ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hex to Binary conversion (https://www.excelbanter.com/excel-programming/276709-re-hex-binary-conversion.html)

JulieJulie

Hex to Binary conversion
 
Tony,
I found the worksheet functions you mentioned, but I'm creating a user form
and I can't find anything like that in the VBA help files
Is there away to send the text from a text box to the worksheet, do the
conversion and then retrieve the answer back to the user form,
Something like cell A1 = txtInput and then lblAnswer = A1 after excel
calculates the answer

Julie
"acw" wrote in message
...
Julie

Excel has a builtin function for this: HEX2BIN. There is
also HEX2DEC and HEX2OCT.


Tony
-----Original Message-----
Does anyone know where I might find a VBA routine that

would convert Hex to
Binary.
I'm trying to build a userform that has several different

conversions and I
can do most of the temperature, distance and these kinds

of things, but when
it comes to the conversions I have been at it for almost

a week and I have a
huge macro that is really clunky and I'm not finished yet.
Any help please
Thanks
Julie


.




John Green[_2_]

Hex to Binary conversion
 
Julie,

There is no need to use a worksheet cell to evaluate Hex2Bin.

Hex2Bin is part of the Analysis ToolPak and can be referenced directly in VBA if you create a reference to the ToolPak. In the VB
Editor, use Tools|References and check the item named atpvbaen.xls.

--

John Green - Excel MVP
Sydney
Australia


"JulieJulie" wrote in message ink.net...
Tony,
I found the worksheet functions you mentioned, but I'm creating a user form
and I can't find anything like that in the VBA help files
Is there away to send the text from a text box to the worksheet, do the
conversion and then retrieve the answer back to the user form,
Something like cell A1 = txtInput and then lblAnswer = A1 after excel
calculates the answer

Julie
"acw" wrote in message
...
Julie

Excel has a builtin function for this: HEX2BIN. There is
also HEX2DEC and HEX2OCT.


Tony
-----Original Message-----
Does anyone know where I might find a VBA routine that

would convert Hex to
Binary.
I'm trying to build a userform that has several different

conversions and I
can do most of the temperature, distance and these kinds

of things, but when
it comes to the conversions I have been at it for almost

a week and I have a
huge macro that is really clunky and I'm not finished yet.
Any help please
Thanks
Julie


.






Tom Ogilvy

Hex to Binary conversion
 
Just to add to John's answer, unlike worksheet functions, since this is an
addin, after creating the reference, you would call it just like a vba
function - no
Application.Hex2Bin

or

worksheetFunction.Hex2Bin

You can also not create the reference and use

? Application.run("ATPVBAEN.XLA!Hex2Bin","FB")
11111011

As an example from the immediate window.

and with the reference set:
? Hex2Bin("FB")
11111011


--
Regards,
Tom Ogilvy


"John Green" wrote in message
...
Julie,

There is no need to use a worksheet cell to evaluate Hex2Bin.

Hex2Bin is part of the Analysis ToolPak and can be referenced directly in

VBA if you create a reference to the ToolPak. In the VB
Editor, use Tools|References and check the item named atpvbaen.xls.

--

John Green - Excel MVP
Sydney
Australia


"JulieJulie" wrote in message

ink.net...
Tony,
I found the worksheet functions you mentioned, but I'm creating a user

form
and I can't find anything like that in the VBA help files
Is there away to send the text from a text box to the worksheet, do the
conversion and then retrieve the answer back to the user form,
Something like cell A1 = txtInput and then lblAnswer = A1 after excel
calculates the answer

Julie
"acw" wrote in message
...
Julie

Excel has a builtin function for this: HEX2BIN. There is
also HEX2DEC and HEX2OCT.


Tony
-----Original Message-----
Does anyone know where I might find a VBA routine that
would convert Hex to
Binary.
I'm trying to build a userform that has several different
conversions and I
can do most of the temperature, distance and these kinds
of things, but when
it comes to the conversions I have been at it for almost
a week and I have a
huge macro that is really clunky and I'm not finished yet.
Any help please
Thanks
Julie


.








Tom Ogilvy

Hex to Binary conversion
 
Perhaps I didn't state it clearly. Only a subset of Excel Builtin functions
can be called with WorksheetFunction.FunctionName. The functions in the
analysis toolpak can not be called using WorksheetFunction as a parent
object.

The analysis toolpak functions can be called in the same way hex2bin as I
showed.

The PMT function is not an analysis toolpak function but a built in function
and it is one of the ones that can be called as

WorksheetFunction.Pmt(0.08/12, 10, 10000, 0, 1)

From the immediate window

? WorksheetFunction.Pmt(0.08/12, 10, 10000, 0, 1)
-1030.16432717797

--
Regards,
Tom Ogilvy


JulieJulie wrote in message
nk.net...
Thanks for all the good information, I'm sure I can get my userform to

work
better now.
Just a question for Mr. Ogilvy, If I can call wooksheetFunction.Hex2Bin,
canI call others the same way.
Like the payment function?

Thanks In Advance, you gentlemen are very helpful,
Julie





"Tom Ogilvy" wrote in message
...
Just to add to John's answer, unlike worksheet functions, since this is

an
addin, after creating the reference, you would call it just like a vba
function - no
Application.Hex2Bin

or

worksheetFunction.Hex2Bin

You can also not create the reference and use

? Application.run("ATPVBAEN.XLA!Hex2Bin","FB")
11111011

As an example from the immediate window.

and with the reference set:
? Hex2Bin("FB")
11111011


--
Regards,
Tom Ogilvy


"John Green" wrote in message
...
Julie,

There is no need to use a worksheet cell to evaluate Hex2Bin.

Hex2Bin is part of the Analysis ToolPak and can be referenced directly

in
VBA if you create a reference to the ToolPak. In the VB
Editor, use Tools|References and check the item named atpvbaen.xls.

--

John Green - Excel MVP
Sydney
Australia


"JulieJulie" wrote in message

ink.net...
Tony,
I found the worksheet functions you mentioned, but I'm creating a

user
form
and I can't find anything like that in the VBA help files
Is there away to send the text from a text box to the worksheet, do

the
conversion and then retrieve the answer back to the user form,
Something like cell A1 = txtInput and then lblAnswer = A1 after

excel
calculates the answer

Julie
"acw" wrote in message
...
Julie

Excel has a builtin function for this: HEX2BIN. There is
also HEX2DEC and HEX2OCT.


Tony
-----Original Message-----
Does anyone know where I might find a VBA routine that
would convert Hex to
Binary.
I'm trying to build a userform that has several different
conversions and I
can do most of the temperature, distance and these kinds
of things, but when
it comes to the conversions I have been at it for almost
a week and I have a
huge macro that is really clunky and I'm not finished yet.
Any help please
Thanks
Julie


.













All times are GMT +1. The time now is 08:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com