Q:

binary to decimal vba code

how to convert binary to decimal in vba code
0
Sub bd()
Funcion Bin2Dec(binVal As String) As Long
Dim binary As Double
Dim iLen As Integer
binVal = Range("c4").Value

iLen = Len(binVal) - 1
For binary = 0 To iLen
    bin2dec = bin2dec + _
      Mid(binVal, iLen - x + 1, 1) * 2 ^ x
Next

End Function
End Sub
0

New to Communities?

Join the community