424 Object Required Error !

J

J_J

Hi,
The below code manages to find if the inputted row is a duplicate of a
previous record and deletes it sucessfully but the VBA compiler gives an
error message as shown on the subject of this message...
Can someone correct the code?
'--------------------------------------------------
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Column >= 3 And Target.Column <= 5 Then ' 3 to 5 stand for C to E
columns

For i = 1 To Target.Row - 1

If (Cells(i, 3) = Cells(Target.Row, 3)) And (Cells(i, 4) =
Cells(Target.Row, 4)) And (Cells(i, 5) = Cells(Target.Row, 5)) Then
MsgBox "Duplicate record!"
Target.EntireRow.Delete
End If

Next

End If

End Sub

'--------------------
Thanks
J_J
 
D

Dave Peterson

Don's point was that you should only post to one newsgroup.

But if you feel the need to post to multiple newsgroups, include them all in one
message--this is called crossposting and when others respond, their answers will
be picked up by all the groups.

By posting to each group separately, responders could waste their time answering
when you already have a solution.

And from a selfish standpoint, you'll have to check all the spots that you
posted--and you fail to get the potential benefit of responders enhancing
solutions posted in other newsgroups.
 
Top