Results 1 to 3 of 3

Thread: bit operations in VBA

  1. #1

    Thread Starter
    Member
    Join Date
    May 2005
    Posts
    59

    bit operations in VBA

    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

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: bit operations in VBA

    Don't you mean bytes?
    Try looking at Hex function ?

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  3. #3

    Thread Starter
    Member
    Join Date
    May 2005
    Posts
    59

    Re: bit operations in VBA

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width