Detectar cambios en una hoja y copiarlos en otra

Para Dante Amor.

Buen día.

Tengo una macro para detectar los cambios en una celda pero necesito que me los copie en otra hoja, no en la misma.

If Target.Count > 100 Then Exit Sub
    If Target.Row = 1 Then Exit Sub
    If Not Intersect(Target, Range("B:B")) Is Nothing Then
        For Each c In Target
            Set b = Columns("M").Find(c.Value, lookat:=xlWhole)
            If b Is Nothing Then
                u = Range("M" & Rows.Count).End(xlUp).Row + 1
                Cells(u, "M") = c.Value
            End If
        Next
    End If

1 Respuesta

Respuesta
1

Supongo que también la búsqueda se tiene que hacer en la otra hoja.

Cambia en la macro "Hoja4" por el nombre de la otra hoja.

Private Sub Worksheet_Change(ByVal Target As Range)
'Por.Dante Amor
    If Target.Count > 100 Then Exit Sub
    If Target.Row = 1 Then Exit Sub
    If Not Intersect(Target, Range("B:B")) Is Nothing Then
        For Each c In Target
            Set h = Sheets("Hoja4")
            Set b = h.Columns("M").Find(c.Value, lookat:=xlWhole)
            If b Is Nothing Then
                u = h.Range("M" & Rows.Count).End(xlUp).Row + 1
                h.Cells(u, "M") = c.Value
            End If
        Next
    End If
End Sub

'S aludos. Dante Amor. Recuerda valorar la respuesta. G racias

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas