M
Mark Scott
Hi
I have successfully created functions for bitwise operators BInary AND, OR
and XOR using the following format in VBA (2010 beta)
Function Bin<operator>(a, b)
Bin<operator> = a <operator> b
End Function
for example the XOR script is:
Function BinXor(a, b)
BinXor = a Xor b
End Function
when I try the same for NOT, VBA comes back with:
Function BinNot(a)
BinNot = Not a
End Function
which is fine as you can only NOT 1 number
The answers are not what I am expecting however, ie the corret outputs are
0=1 and 1=0 whereas the functions output is: 1= -2 and 0 = -1
What do I need to do to make this work or is there a built in "binary flip"
function in Excel?
Regards
Mark
I have successfully created functions for bitwise operators BInary AND, OR
and XOR using the following format in VBA (2010 beta)
Function Bin<operator>(a, b)
Bin<operator> = a <operator> b
End Function
for example the XOR script is:
Function BinXor(a, b)
BinXor = a Xor b
End Function
when I try the same for NOT, VBA comes back with:
Function BinNot(a)
BinNot = Not a
End Function
which is fine as you can only NOT 1 number
The answers are not what I am expecting however, ie the corret outputs are
0=1 and 1=0 whereas the functions output is: 1= -2 and 0 = -1
What do I need to do to make this work or is there a built in "binary flip"
function in Excel?
Regards
Mark