
Signature
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
Max, that works except what I'm trying to do is change the number in A1 to
the resulting text in the same cell. In otherwords, if A1=400, change the
400 in A1 to "James" So if I type 400 in A1 it will automatically change it
to "James" as soon as I move to the next cell.

Signature
Carolan
> Maybe something like this
>
[quoted text clipped - 5 lines]
> > several name. For example, 400 = James, 401 - John, 402 = Kevin. So there
> > could be all three numbers in a column.
David Biddulph - 12 May 2008 18:09 GMT
As stated earlier, that needs a macro, not a formula.
--
David Biddulph
> Max, that works except what I'm trying to do is change the number in A1 to
> the resulting text in the same cell. In otherwords, if A1=400, change the
[quoted text clipped - 12 lines]
>> > there
>> > could be all three numbers in a column.
Ron Rosenfeld - 12 May 2008 18:15 GMT
>Max, that works except what I'm trying to do is change the number in A1 to
>the resulting text in the same cell. In otherwords, if A1=400, change the
>400 in A1 to "James" So if I type 400 in A1 it will automatically change it
>to "James" as soon as I move to the next cell.
As has been written, you cannot do that with a formula. A formula can only
return a result to the cell in which it resides. It cannot change another
cell, nor can it change itself, yet persist within the cell.
Take another look at Gary's student macro.
Or, if you want this automatically, use an event macro.
To enter this, right click on the sheet tab and select View Code from the
dropdown menu. Then paste the code below into the window that opens.
=========================
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim a As Range
Dim c As Range
'set up to change entries in Column A only
Set a = Range("A:A")
If Not Intersect(Target, a) Is Nothing Then
For Each c In Target
Select Case c
Case Is = 400
c.Value = "James"
Case Is = 401
c.Value = "John"
Case Is = 402
c.Value = "Kevin"
End Select
Next c
End If
End Sub
=================================
--ron
Carolan - 13 May 2008 17:58 GMT
Thanks everyone - Ron's solution worked perfectly for my needs.

Signature
Carolan
> >Max, that works except what I'm trying to do is change the number in A1 to
> >the resulting text in the same cell. In otherwords, if A1=400, change the
[quoted text clipped - 34 lines]
> =================================
> --ron
Gord Dibben - 13 May 2008 18:36 GMT
In addition to Ron's "worked perfectly" solution.
If your needs changed to many of these items, you can add to the "nums" and
"vals" arrays and not use the many "Case is" statements.
Private Sub Worksheet_Change(ByVal Target As Range)
Set r = Range("A:A") 'adjust to suit
If Intersect(Target, r) Is Nothing Then
Exit Sub
On Error GoTo endit:
Application.EnableEvents = False
End If
nums = Array(400, 401, 402, 403) 'adjust to suit
vals = Array("James", "Mike", "Harold", "Oscar") 'adjust to suit
For Each rr In r
ival = 0
For i = LBound(nums) To UBound(nums)
If rr.Value = nums(i) Then
ival = vals(i)
End If
Next
If ival > 0 Then
rr.Value = ival
End If
Next
endit:
Application.EnableEvents = True
End Sub
Gord Dibben MS Excel MVP
>Thanks everyone - Ron's solution worked perfectly for my needs.
Max - 12 May 2008 22:21 GMT
If you want to keep it simple, you could always copy the formula col at the
end of the day, then overwrite the source col with a paste special as values

Signature
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
> Max, that works except what I'm trying to do is change the number in A1 to
> the resulting text in the same cell. In otherwords, if A1=400, change the
> 400 in A1 to "James" So if I type 400 in A1 it will automatically change it
> to "James" as soon as I move to the next cell.