PDA

Click to See Complete Forum and Search --> : bit operations in VBA


nastya
Jun 20th, 2005, 01:01 AM
I need to place integer number in 2 bits .
something like this :

dim int_num as integer
dim byte_array(2) as byte

if(int_num < 256) then byte_array(0) = Cbyte(int_num)
else
byte_array(0) = ?
byte_array(1) = ?
end if

Does VBA has a bit shift operators/functions? if no, is there another way to solve my question?
10x

Ecniv
Jun 20th, 2005, 02:42 AM
Don't you mean bytes?
Try looking at Hex function ?

nastya
Jun 20th, 2005, 03:40 AM
yes, bytes ...
i haven't found bit shift operations, but there is way to do thit without :

byte_0 = int_num And &HFF
byte_1 = int_num \ &H100 And &HFF