Good morning,
I need help to amend the following code.
What should happen is this: the first thing that I do in my worksheet is to type in the activity name (ie run) in a cell.
Then I type in the distance in the cell below (ie 10).
When both values are typed in, I would like the calculation to take place and display in the cell below.
Currently, when I type in “run” the calculation takes place however, since there are no value in the Target.Offset(1) cell yet, Target.Offset(2) cell displays “0” which is fine, but after entering the distance in Target.Offset(1) cell, the calculation does no longer works and Target.Offset(2) cell remains at 0.
How can I change it so Target.Offset(2) cell gets updated once a value is entered in Target.Offset(1) cell?
Thanks
I need help to amend the following code.
What should happen is this: the first thing that I do in my worksheet is to type in the activity name (ie run) in a cell.
Then I type in the distance in the cell below (ie 10).
When both values are typed in, I would like the calculation to take place and display in the cell below.
Currently, when I type in “run” the calculation takes place however, since there are no value in the Target.Offset(1) cell yet, Target.Offset(2) cell displays “0” which is fine, but after entering the distance in Target.Offset(1) cell, the calculation does no longer works and Target.Offset(2) cell remains at 0.
How can I change it so Target.Offset(2) cell gets updated once a value is entered in Target.Offset(1) cell?
Thanks
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = 9 Or 13 Or 21 Or 25 And Target.Column > 1 Then
Application.EnableEvents = False
Select Case LCase(Target.Value)
Case "run"
Target.Offset(2).Value = Target.Offset(1).Value * 1
Case "row", "hockey"
Target.Offset(2).Value = Target.Offset(1).Value * 2
End Select
Application.EnableEvents = True
End If
End Sub