Esta es la macro para la actualización:
Private Sub Worksheet_Change(ByVal Target As Range)
'Por.Dante Amor
If Not Intersect(Target, Range("Y:Y")) Is Nothing Then
If Target.Count = 1 Then
Set l1 = ThisWorkbook
Set h1 = l1.ActiveSheet
Set l2 = Workbooks("Archivo tm")
Set h2 = l2.Sheets("Inventario ")
Set r = h2.Columns("B")
Set b = r.Find(h1.Cells(Target.Row, "B"), lookat:=xlWhole)
pos = h1.Cells(Target.Row, "I")
existe = False
If Not b Is Nothing Then
ncell = b.Address
Do
If h2.Cells(b.Row, "H") = pos Then
existe = True
Exit Do
End If
Set b = r.FindNext(b)
Loop While Not b Is Nothing And b.Address <> ncell
Else
existe = False
End If
If existe Then
H2. Cells(b.Row, "A") = h1. Cells(Target.Row, "A")
H2. Cells(b.Row, "C") = h1. Cells(Target.Row, "C")
H2. Cells(b.Row, "D") = h1. Cells(Target.Row, "D")
H2. Cells(b.Row, "F") = h1. Cells(Target.Row, "F")
H2. Cells(b.Row, "G") = h1. Cells(Target.Row, "G")
H2. Cells(b.Row, "I") = h1. Cells(Target.Row, "N")
MsgBox "Registro actualizado"
Else
u = h2.Range("A" & Rows.Count).End(xlUp).Row + 1
H2.Cells(u, "A") = h1. Cells(Target.Row, "A")
H2.Cells(u, "B") = h1. Cells(Target.Row, "B")
H2.Cells(u, "C") = h1. Cells(Target.Row, "C")
H2.Cells(u, "D") = h1. Cells(Target.Row, "D")
H2.Cells(u, "E") = h1. Cells(Target.Row, "E")
H2.Cells(u, "F") = h1. Cells(Target.Row, "F")
H2.Cells(u, "G") = h1. Cells(Target.Row, "G")
H2.Cells(u, "H") = h1. Cells(Target.Row, "I")
H2.Cells(u, "I") = h1. Cells(Target.Row, "N")
H2.Cells(u, "N") = h1. Cells(Target.Row, "Y")
H2.Cells(u, "O") = h1. Cells(Target.Row, "S")
MsgBox "Registro creado"
End If
End If
End If
End Sub
Saludos.Dante Amor
No olvides valorar la respuesta.