View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
David McRitchie David McRitchie is offline
external usenet poster
 
Posts: 903
Default convert numbers to alpha code

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.


--

---
HTH,
David McRitchie, Microsoft MVP - Excel
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"chas" wrote in message ...
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.