Try this:
Dim strbin As String
Dim lngnum As Long
Dim x As Integer
strbin = "1001"
For x = 1 To Len(strbin)
If Mid(strbin, x, 1) = "1" Then lngnum = lngnum + 2 ^ (Len(strbin) - x)
Next
------------------
John Percival
Editor, VB-World.net
[email protected]




Reply With Quote