Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
dec2bin
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 .. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
dec2bin
dont be hasty when posting.. it just takes some time for the post to filter thru... see my answer to your first attempt! -- 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 . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
dec2bin
thanks, I never realised it was the same site, it appears totally different!
"keepITcool" wrote: dont be hasty when posting.. it just takes some time for the post to filter thru... see my answer to your first attempt! -- 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 . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
dec2bin
thanks, how about bin to dec?
"keepITcool" wrote: dont be hasty when posting.. it just takes some time for the post to filter thru... see my answer to your first attempt! -- 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 . |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
dec2bin
Hi
reason for this is that you access the NG through a web interface and not via a newsreader directly. Maybe check out: http://www.mvps.org/dmcritchie/excel/xlnews.htm -- Regards Frank Kabel Frankfurt, Germany "Jo" schrieb im Newsbeitrag ... thanks, I never realised it was the same site, it appears totally different! "keepITcool" wrote: dont be hasty when posting.. it just takes some time for the post to filter thru... see my answer to your first attempt! -- 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 . |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
dec2bin
I've tried to make m complimentary to ATP's functions. These work for (large) negative amounts too, interpretation of negative binary strings <255 is always a gamble.. my rule is: negatives binTodec must have a lenght of multiple8 +2 (and start with 11) Function DecToBin(ByVal Number As Long, Optional Places As Integer) As String Dim neg%, s$ neg = Number < 0 Number = Abs(Number) + neg Do s = (Number - neg) Mod 2 & s Number = Number \ 2 Loop While Number 0 If Places < Len(s) Then Places = Len(s) End If 'Length s/b Multiple of 8 Places = Places - (Places - 1) Mod 8 + 7 s = String$(Places - Len(s), CStr(CInt(-neg))) & s If neg Then s = "11" & s End If DecToBin = s End Function Function BinToDec(ByVal BinString As String) As Long Dim neg%, l&, i%, n% n = Len(BinString) neg = n 8 And n Mod 8 = 2 If neg Then BinString = Mid(BinString, 3) n = n - 2 End If For i = 0 To n - 1 If Mid(BinString, n - i, 1) < CInt(-neg) Then l = l + 2 ^ i End If Next BinToDec = (neg - Not neg) * l + neg End Function -- keepITcool | www.XLsupport.com | keepITcool chello nl | amsterdam Jo wrote : thanks, how about bin to dec? "keepITcool" wrote: dont be hasty when posting.. it just takes some time for the post to filter thru... see my answer to your first attempt! -- 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 . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
What 'value' is a Dec2Bin output? | Excel Discussion (Misc queries) | |||
=Dec2bin can you increase the number bits please | Excel Discussion (Misc queries) | |||
How to get leading zeros using DEC2BIN | Excel Worksheet Functions | |||
Base number functions, example DEC2BIN | Setting up and Configuration of Excel | |||
dec2bin | Excel Programming |