Re: Coverting Alphabets into Numbers

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



-Paste this code into a module
-Type, "BFDJ", into cell "A1"
-Type, =Decode("A1"), in cell "A2"
-Cell "A2" will return 2640

Regards,
Dave


Public Function DeCode(r As Variant) As Long
Dim i As Integer, _
l As String

For i = 1 To Len(r)
l = l & GetValue(Mid(r, i, 1))
Next

DeCode = l
End Function

Private Function GetValue(s As String) As String
Select Case s
Case Is < "J"
GetValue = Asc(s) - 64
Case "J"
GetValue = "0"
End Select
End Function

.


Quantcast