Converting numbers to alpha

Registration date
Tuesday January 6, 2015
Last seen
January 6, 2015
- Jan 6, 2015 at 01:02 PM
 RayH - Jan 6, 2015 at 04:51 PM
I need a simple way to convert a price to an alpha code, for instance Graystoke = 1,2,3,4,5,6,7,8,9,0 so if a price is $5.66 it appears as

I need to put a price in one cell and have it show in the next cell as alpha equivalent.


1 reply

That cannot work as there are only 9 characters in 'Graystoke'.
The string would have to be 10 long.

For strings that are 10 long values (GraystokeX), a $5.90 would be "s.eX".
Where Zeros are counted as position 10.
Is that right?

Public Function convertalpha(compstring As Variant, myvalue As Currency) As String

Dim x As String
Dim y as String
Dim n As Integer
Dim newvalue As String

y = CStr(compstring)

x = CStr(Format(myvalue, "######.00"))

For n = 1 To Len(x)
pos = Mid(x, n, 1)
If pos = 0 Then pos = 10

If Mid(x, n, 1) = "." Then
char = "."
char = Mid(y, pos, 1)
End If

newvalue = newvalue & char
Next n

convertalpha = newvalue
End Function

in a cell put:

where A1 is the string (GraystokeX)
and B1 is the value (5.90)