ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   convert numbers to alpha code (https://www.excelbanter.com/excel-discussion-misc-queries/120120-convert-numbers-alpha-code.html)

chas

convert numbers to alpha code
 
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.

David McRitchie

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.





All times are GMT +1. The time now is 05:01 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com