Cómo hacer para copiar, pegar y borrar sólo parte del contenido

Mediante la siguiente macro, al introducir un valor en F copio A:W de la fila anterior (formato y contenido) y lo pego en la fila activa. Lo que quisiera agregar es que también borre el contenido de F:R, T:V de la fila activa. Porque en realidad lo que estoy buscando es que en A:E, S, W copie formato y contenido de la fila anterior, y en F:R, T:V copie sólo el formato de la fila anterior... ¿Qué debería agregar y/o cambiar de la macro actual?

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 6 Then
fila = Target.Row
Range("A" & fila - 1 & ":W" & fila - 1).Copy
Range("A" & fila & ":W" & fila).PasteSpecial Paste:=xlPasteAll
Application.CutCopyMode = False
Target.Offset(0, 0).Select
End If
End Sub

2 Respuestas

Respuesta
2

Te anexo la macro actualizada

Private Sub Worksheet_Change(ByVal Target As Range)
'Act.Por.Dante Amor
    If Target.Count > 1 Then Exit Sub
    If Target.Value = "" Then Exit Sub
    If Target.Row = 1 Then Exit Sub
    '
    If Target.Column = Columns("F").Column Then
        Application.EnableEvents = False
        fila = Target.Row
        Range("A" & fila - 1 & ":E" & fila - 1).Copy Range("A" & fila)
        Range("S" & fila - 1).Copy Range("S" & fila)
        Range("W" & fila - 1).Copy Range("W" & fila)
        Range("F" & fila - 1 & ":R" & fila - 1).Copy
        Range("F" & fila).PasteSpecial Paste:=xlFormats
        Range("T" & fila - 1 & ":U" & fila - 1).Copy
        Range("T" & fila).PasteSpecial Paste:=xlFormats
        Application.CutCopyMode = False
        Target.Offset(0, 0).Select
        Application.EnableEvents = True
    End If
End Sub

.

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

.

Avísame cualquier duda

.

Respuesta

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas