this should do..
Function DecToBin(ByVal Number As Long, _
Optional Places As Integer) As String
Dim l As Long, s As String
l = Number
Do
s = (l Mod 2) & s
l = l \ 2
Loop While l 0
If Places 0 And Places Len(s) Then
s = String$(Places - Len(s), "0") & s
End If
DecToBin = s
End Function
--
keepITcool
|
www.XLsupport.com | keepITcool chello nl | amsterdam
Jo wrote :
Hi
Is there something analagous to dec2bin (worksheet) for
VBA?
I need to change a 5 digit decimal into a 16 character
binary expression.
Thanks
Jo