Integer to boolean/bit array without looping

Viewed 2182

I have a number (say 5) which I would first like to convert to binary (101) and then split into an array of bits {1,0,1} or Booleans {True,False,True} in VBA

Is there a way to do this without looping?

I can convert to Binary without looping in my code with the worksheet formula as follows

myBinaryNum = [DEC2BIN(myDecInteger,[places])]

But I've been told that worksheet functions are very inefficient, and this one is particularly limited.

I'm not sure how to split into an array without looping through the digits with MID. Is there anything like strConv for numbers?

7 Answers
Related