Please Help...
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A1:A4" '<== change to suit
On Error GoTo ws_exit
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
Select Case .Value
Case "Andy"
.Offset(0, 1).Value = 78
.Offset(0, 2).Value = 98
.Offset(0, 3).Value = 85
Case "Jane"
.Offset(0, 1).Value = 45
.Offset(0, 2).Value = 65
.Offset(0, 3).Value = 96
Case "David"
.Offset(0, 1).Value = 12
.Offset(0, 2).Value = 32
.Offset(0, 3).Value = 41
Case "Sam"
.Offset(0, 1).Value = 23
.Offset(0, 2).Value = 74
.Offset(0, 3).Value = 52
End Select
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub
'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.
--
HTH
Bob
(there's no email, no snail mail, but somewhere should be gmail in my addy)
"newbie" wrote in message
...
Hi,
I had a table of data and would like to go the following... please help...
A B C D
1 Andy 78 98 85
2 Jane 45 65 96
3 David 12 32 41
4 Sam 23 74 52
If I type in "Andy" in Cell 1, I like Cell 2 to display 78, Cell 3 to
display 98 and Cell 4 to display 85 automatically.
Please help. Thank you.
|