How to make text in a cell equal a number
In same cell would require either AutoCorrect from ToolsAutoCorrect Options or
event code.
How many letters are you speaking of?
If using Autocorrect I would suggest something like ax, bx, cx, dx etc.
For event code.....................
Private Sub Worksheet_Change(ByVal Target As Range)
Set r = Range("A1:A100")
If Intersect(Target, r) Is Nothing Then
Exit Sub
End If
vals = Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J")
nums = Array(8, 9, 6, 3, 7, 4, 20, 10, 23, 15)
For Each rr In r
inum = 0
For i = LBound(vals) To UBound(vals)
If UCase(rr.Value) = vals(i) Then
inum = nums(i)
End If
Next
If inum 0 Then
rr.Value = inum
End If
Next
End Sub
This is sheet event code. Right-click on the sheet tab and "View Code".
Copy/paste into that sheet module.
Adjust Set r = Range("A1:A100"), vals and nums to suit.
Note: if wanting 8FF, enter double quotes around nums values as in "8FF"
Gord Dibben MS Excel MVP
On Sat, 22 Sep 2007 12:04:00 -0700, Dantron
wrote:
If I want to type a letter in a cell, can I have that cell convert the letter
to a number ?example, type in A1 the letter A and have A1 return the number
8, or 8FF I am using Excel 2003
|