Thaks Max
You're dabbling now<g>
Just for interest's sake........................
Rick Rothstein's revision with minimal looping.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim ival as Long
Set R = Range("A1:A100")
If Intersect(Target, R) Is Nothing Or Target.Count > 1 Then Exit Sub
Application.EnableEvents = False
Vals = Array("C", "D", "G", "H", "K", "L", "O", "S", "C", "X")
Nums = Array(8, 9, 6, 3, 7, 4, 20, 10, 8, 15)
For i = LBound(Vals) To UBound(Vals)
If UCase(Target.Value) = Vals(i) Then ival = Nums(i)
Next
Target.Value = ival
Application.EnableEvents = True
End Sub
Bob Phillips and Bernie Dietrick also showed me how to put the vals and nums
in ranges and use that instead.
Values in G1:G10.....................Numbers in H1:H10
Private Sub Worksheet_Change(ByVal Target As Range)
Dim ival As Long
Dim R As Range
Set R = Range("A1:A100")
If Intersect(Target, R) Is Nothing Then Exit Sub
If Not IsError(Application.Match(Target.Value, _
Me.Range("G1:G10"), 0)) Then
ival = Application.VLookup(Target.Value, _
Me.Range("G1:H10"), 2, False)
Target.Value = ival
End If
End Sub
Either of these should have been posted instaed of the loopy thing I posted.
Gord