Macro 32 Ramblings

Mind Archive

Excel bin2dec2

Public Function bin2dec2(BinVal As String) As String
Dim iVal#, temp#, i%, Length%
Length = Len(BinVal)
For i = 0 To Length – 1
temp = CInt(Mid(BinVal, Length – i, 1))
iVal = iVal + (temp * (2 ^ i))
Next i
bin2dec2 = iVal
End Function


Leave a Reply