Forum Discussion
dan80_30
Nov 27, 2020Copper Contributor
DATA VALIDATION
You can help me please, I'm working on an excel sheet and I need that if in cell B1 I write the number 2 then in cell A1 only allow to enter digits between 0 and 1 and that also does not exceed the l...
Willy Lau
Nov 30, 2020Iron Contributor
Can it support 24 digits binary number?
NikolinoDE
Nov 30, 2020Platinum Contributor
I am sure if you searched there would be loads of examples of this, but here is a quick function I knocked up for you:
Option Explicit
Public Function LongBinary(lngNumber As Long) As String
Dim lngExp As Long
Dim strBinary
If lngNumber < 0 Then Exit Function
Do While 2 ^ lngExp <= lngNumber
strBinary = -((lngNumber And (2 ^ lngExp)) <> 0) & strBinary
lngExp = lngExp + 1
Loop
LongBinary = strBinary
End Function
I would be happy to know if I could help.
Nikolino
I know I don't know anything (Socrates)
* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here.