Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Rng As Range, lr As Long
lr = Range("A65000").End(3).Row
Application.ScreenUpdating = False
If Not Intersect(Target, Range("C2")) Is Nothing Then
Set Rng = Range([A4], [A65000].End(3)).Find(Target.Value, , xlValues, xlWhole)
If Not Rng Is Nothing And Target <> Empty Then
MsgBox "Du lieu da co roi cha noi!"
Else
Set Rng = Sheet1.Range(Sheet1.[A2], Sheet1.[A65000].End(3)).Find(Target.Value, , xlValues, xlWhole)
If Not Rng Is Nothing Then
Range("A" & lr + 1).Resize(, 5) = Rng.Resize(, 5).Value
End If
End If
End If
If Not Intersect(Target, Range("D2")) Is Nothing Then
Set Rng = Range([B4], [B65000].End(3)).Find(Target.Value, , xlValues, xlWhole)
If Not Rng Is Nothing And Target <> Empty Then
MsgBox "Du lieu da co roi cha noi!"
Else
Set Rng = Sheet1.Range(Sheet1.[B2], Sheet1.[B65000].End(3)).Find(Target.Value, , xlValues, xlWhole)
If Not Rng Is Nothing Then
Range("A" & lr + 1).Resize(, 5) = Rng.Offset(, -1).Resize(, 5).Value
End If
End If
Application.ScreenUpdating = True
End If
End Sub