Macro para copiar en hoja 2 y luego continuar en hoja 3 para (Dante Amor)

Hola Dante:

La mejor opción sería que copiara hasta el final de la hoja 2 y luego pase a la hoja 3 y una vez completa la 3 siga en la 4 y así sucesivamente.

¿Se podrá?

Saludos 

1 respuesta

Respuesta
1

En la hoja1 tienes una macro, cámbiala por esta

Private Sub Worksheet_Change(ByVal Target As Range)
'Por.Dante amor
    If Not Intersect(Target, Range("A2")) Is Nothing Then
        Application.ScreenUpdating = False
        Set h1 = Sheets("Hoja1")
        Set h2 = Sheets("Hoja2")
        u = h2.Range("A" & Rows.Count).End(xlUp).Row
        fin = h2.Range("A" & Rows.Count).Row - 1
        If u = fin Then
            h2.Copy after:=Sheets(Sheets.Count)
            h2.Range("A2:D" & u).Clear
        End If
        u = h2.Range("A" & Rows.Count).End(xlUp).Row
        If h1.Cells(2, "A") <> h2.Cells(u, "A") Or _
           h1.Cells(2, "B") <> h2.Cells(u, "B") Then
            u = u + 1
            h1.Rows(2).Copy
            h2.Cells(u, "A").PasteSpecial Paste:=xlValues
            h2.Cells(u, "C") = Date
            h2.Cells(u, "D") = Time
        End If
        Application.CutCopyMode = False
    End If
End Sub

Cada vez que se llene la hoja2, te copia la hoja2 a una hoja nueva y limpia la hoja2 para iniciar nuevamente en la fila 2 de la hoja2.

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas