View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Martin Fishlock Martin Fishlock is offline
external usenet poster
 
Posts: 694
Default replace or substitute a letter for a specific number

Try this macro you have to open the macro editor, insert a module and paste
it in and then must =convertnr(A1) in B1 if the number is in A1.

Function convertnr(r As Range) As String
' could change it to string and adjust the ucase line to r only.
Dim s_converted As String
Dim s_original As String
Dim s As String
Dim i As Long

s_original = UCase(r.Value)
For i = 1 To Len(s_original)
s = Mid(s_original, i, 1)
If IsNumeric(s) Then
s_converted = s_converted & s
Else
s_converted = s_converted & Asc(s)
End If
Next i
convertnr = s_converted
End Function

--
Hope this helps
Martin Fishlock
Please do not forget to rate this reply.


"El Criollo" wrote:

Say A=65, B=66, C=76.. Z=90
I want to convert the alfanumeric value "AB25" into 656625...
Cant find the way to replace/substitute A for 65 and B for 66 followed by 25
to make a
single number...
Is this possible???
THANX