decimal number convert to 16bit binary

G

Guest

My column A fill with decimal numbers, I want it to be converted 16 bit
binary and each binary bit go to each column. Anybody can give some
teach,thanks.
 
N

NickHK

Peter,
Here's one way :
Dim i As Long

With ActiveCell
For i = 0 To 15
.Offset(0, 16 - i).Value = -1 * ((.Value And 2 ^ i) > 0)
Next
End With

NickHK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top