Jump to content
joselopezitot

Macro - copiar n veces un rango de celdas y pegar

Recommended Posts

Hola jose

Prueba asi

Sub CopiarnVeces_GP()

Application.ScreenUpdating = False

Dim Rango As Range: Set Rango = Range("F17:L18")
vnc = Range("C7")
For i = 1 To vnc
    vuf = Range("F" & Rows.Count).End(xlUp).Row
    Rango.Copy
    Range("F" & vuf).Offset(6).PasteSpecial
Next

Application.CutCopyMode = 0: Set Rango = Nothing
Application.ScreenUpdating = True

End Sub

 

Saludos 

Share this post


Link to post
Share on other sites

Hola @joselopezitot y @Gerson Pineda, les dejo mi aporte:

Option Explicit

Sub copiar()
Dim rango As Range
Dim n As Integer, i As Integer, filas As Integer

Set rango = Application.InputBox("Selecciona el rango a copiar", Type:=8)
n = InputBox("Numero de veces a copiar:")
filas = 8

For i = 1 To n
  rango.Copy rango.Offset(filas * i)
Next
End Sub

Si estas aprendiendo, siempre declara variables principalmente para proyectos grandes/complejos. Restablecer variables objetos a Nothing nunca lo he echo, los libros sugieren hacerlo.

 

Share this post


Link to post
Share on other sites
En 5/12/2017 at 16:59 , Gerson Pineda dijo:

Hola jose

Prueba asi

Sub CopiarnVeces_GP()

Application.ScreenUpdating = False

Dim Rango As Range: Set Rango = Range("F17:L18")
vnc = Range("C7")
For i = 1 To vnc
    vuf = Range("F" & Rows.Count).End(xlUp).Row
    Rango.Copy
    Range("F" & vuf).Offset(6).PasteSpecial
Next

Application.CutCopyMode = 0: Set Rango = Nothing
Application.ScreenUpdating = True

End Sub

 

Saludos 

Muchas gracias, Me ayudo Bastante

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.



×
×
  • Create New...

Important Information

Privacy Policy


CTA Templates.png