How do I code using a cell?

[Closed]
Report
Posts
7
Registration date
Monday December 14, 2015
Status
Member
Last seen
December 16, 2015
-
 Blocked Profile -
Hello,

I want to make a code that takes "50,41,62,62,60" and change each number to a letter so it's says something like a phrase such as "hello" how would I do that?
thank you

1 reply


Please understand, we are volunteers who help when stuck!

It sounds like you have a homework problem? If not, I encourage you to look up and read about VBA-Visual Basic for Applications. It is a Microsoft platform and is widely excepted!
Blocked Profile
@Thank you for your fine explanation.
Here is a function that does what you need.

In a module put the following code:
Function ConvertCode(code As Range) As String

Start = 1
While Start < Len(code)

    Pos = InStr(Start, code, ",", vbTextCompare)
    If Pos = 0 Then Pos = Len(code) + 1
    StrValue = Mid(code, Start, Pos - Start)
    Start = Pos + 1
    Set rng1 = Range("A1:A31").Find(StrValue, , xlValues, xlWhole)
    StrValue = rng1.Offset(0, 1)
    ConvertCode = ConvertCode & StrValue
    
Wend

End Function



This assumes the following (as I do not know the layout you are using):
1.Column A contains the number.
2.Column B contains the character

The Range contains 31 rows as the list of characters includes other non-alphabetic characters such as Space, #, $, as these may be useful. Add other characters as you need but adjust the range accordingly.

To use the function, lets say the code you want to convert is in cell D2, in another cell, put:
=ConvertCode(D2)
Posts
7
Registration date
Monday December 14, 2015
Status
Member
Last seen
December 16, 2015
> RayH
For some reason it just gives me errors
>
Posts
7
Registration date
Monday December 14, 2015
Status
Member
Last seen
December 16, 2015

ok.
Blocked Profile
Wow, so I can get service like this for my coding problems?