![]() |
Creating a Copy/Paste Loop
Hello all! I'm brand new to macros and VBA. I've searched
everywhere, but can't seem to come up with a solution for this simple task. I have 45 rows x 4 columns worth of data that need to be copied down in 51 row increments (no column movement). Right now I'm using the code below and it works once, but I need to highlight the newly created cell and repeat manually. The last row to paste the selection on is 1565. I have no idea how to make it loop. Any help would be greatly appreciated! ActiveCell.Resize(45, 4).Copy.ActiveCell.Offset(51, 0) Application.CopyCutMode = False |
Creating a Copy/Paste Loop
This will go to row 1575.
Sub cpy51() lstRw = Cells(Rows.Count, 1).End(xlUp).Row Do Until lstRw = 1565 ActiveCell.Resize(45, 4).Copy ActiveCell.Offset(51, 0) lstRw = lstRw + 51 Range("A" & lstRw - 44).Activate Loop End Sub " wrote: Hello all! I'm brand new to macros and VBA. I've searched everywhere, but can't seem to come up with a solution for this simple task. I have 45 rows x 4 columns worth of data that need to be copied down in 51 row increments (no column movement). Right now I'm using the code below and it works once, but I need to highlight the newly created cell and repeat manually. The last row to paste the selection on is 1565. I have no idea how to make it loop. Any help would be greatly appreciated! ActiveCell.Resize(45, 4).Copy.ActiveCell.Offset(51, 0) Application.CopyCutMode = False |
Creating a Copy/Paste Loop
Thank you so much!! Now I understand the concept!!!
|
All times are GMT +1. The time now is 01:36 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com