convert numbers to alpha code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to convert numbers to an alpha equivilant. ie if colum a is 123 I
would like colum b to convert that to abc.
 
Seems useless enough to be homework, especially with all of the
misspellings. Here is an example that will convert what is in a cell
that is double-clicked to a value and place it into the cell to the
right, regardless of previous content.

Install by right clicking on the worksheet tab, choose "View Code"
and insert the following.

Option Explicit
Private Sub Worksheet_BeforeDoubleClick(ByVal Target _
As Range, Cancel As Boolean)
Cancel = True
Dim i As Double, str As String, txt As String
txt = Target.Value
Dim v As Integer
str = ""
For i = 1 To Len(txt)
If IsNumeric(Mid(txt, i, 1)) Then
v = Mid(txt, i, 1) + 1
str = str & Mid("jabcdefghi", v, 1)
Else
str = str & Mid(txt, i, 1)
End If
Next i
Target.Offset(0, 1) = str
End Sub



You can read more about macros on my pages.


--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top