Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row > 21 Then
If Target.Column = 3 Then
caonhâncôt Target
End If
End If
End Sub
Private Sub caonhâncôt(ByVal Tg As Range)
If Tg.Value <> Empty Then
Tg.Offset(, -1) = "=VLOOKUP($C" & Tg.Row & ",NXT!$A$4:$H$10000,3,FALSE)"
Tg.Offset(, 1) = "=VLOOKUP($C" & Tg.Row & ",NXT!$A$4:$H$10000,4,FALSE)"
Tg.Offset(, 2) = "=VLOOKUP($C" & Tg.Row & ",NXT!$A$4:$H$10000,5,FALSE)"
Tg.Offset(, 3) = "=VLOOKUP($C" & Tg.Row & ",NXT!$A$4:$H$10000,6,FALSE)"
Else
Tg.Offset(, -1).ClearContents
Tg.Offset(, 1).ClearContents
Tg.Offset(, 2).ClearContents
Tg.Offset(, 3).ClearContents
End If
End Sub