Please Advise "Worksheet_Change"


Posted by Jim on May 20, 2001 12:35 PM

Hi,
Can someone show me how to tweak this so it also works in row 29 as well.
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
On Error Resume Next
If IsNumeric([A28]) And IsNumeric([G28]) Then
If Taget = [G28] Then
Worksheets("Sheet2").[G28].Value = [G28]
[G28].Value = [G28] * [A28]
ElseIf Target = [A28] Then
[G28].Value = Worksheets("Sheet2").[G28] * [A28]
End If
End If
Application.EnableEvents = True
End Sub
Thanks,Jim

Posted by Dave Hawley on May 20, 2001 12:44 PM

Hi Jim

Without knowing your final aim, try this:


Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
On Error Resume Next

If IsNumeric([A28]) And IsNumeric([G28]) Then
If Target = [G28] Then
Worksheets("Sheet2").[G28].Value = [G28]
[G28].Value = [G28] * [A28]
ElseIf Target = [A28] Then
[G28].Value = Worksheets("Sheet2").[G28] * [A28]
End If
End If

If IsNumeric([A29]) And IsNumeric([G29]) Then
If Target = [G29] Then
Worksheets("Sheet2").[G29].Value = [G29]
[G29].Value = [G29] * [A29]
ElseIf Target = [A29] Then
[G29].Value = Worksheets("Sheet2").[G29] * [A29]
End If
End If

Application.EnableEvents = True
End Sub

Dave

OzGrid Business Applications

Posted by Jim on May 20, 2001 1:01 PM

Dave,
That's one of the many that i've tried, but it
has an effect on both rows 28 & 29, they actually
need to be independent of one another.
Any thoughts are always appreciated
Jim



Posted by Jim on May 20, 2001 1:21 PM

Thanks Dave, It works!