Multiple Times Paste within the same sheet

An Quala

Board Regular
Joined
Mar 21, 2022
Messages
146
Office Version
  1. 2021
Platform
  1. Windows
Hello,

It's a pretty straightforward issue, I need to paste a set of rows (template), available in the first 3 columns of the excel sheet multiple times, for instance, 500 times, can anyone please help me to that with a VBA Code?

I am a very beginner with VBA.

Thank you.

Template Example.xlsx
C
4
Sheet1
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Note that you image did not come out right. Can you try posting that again so we can see what we are working with?
Note that there is a Test Here forum you can use to test post these images to make sure you are doing it correctly before posting to this ticket.
 
Upvote 0
Just to add to what Joe4 has said, you need to select the range you want posted before using XL2BB. You only had C4 selected when you used it the first time.
 
Upvote 0
My Template.xlsx
ABCDEFGHIJKLMNOPQRS
1Record IDRecord TypeCampaign IDCampaignCampaign Daily BudgetPortfolio IDCampaign Start DateCampaign End DateCampaign Targeting TypeAd GroupMax BidKeyword or Product TargetingProduct Targeting IDMatch TypeSKUCampaign StatusAd Group StatusStatusBidding strategy
2campaignABC10181145945523437autoenableddynamic bidding (down only)
3ad groupABCABC0.5enabled
4adABCABCABCenabled
Sheet1
 
Upvote 0
Hi, now I have attached the full image, I just want to have a VBA to paste the RANGE A2:S4 to let's say 500 times within same sheet from A5, one after another.
 
Upvote 0
VBA Code:
Sub CopyData()
Dim lRow As Long
Dim Num As Integer
Num = InputBox("How many Times")
lRow = 1

Do While Num > 0

Range(Cells(2, "A"), Cells(4, "S")).Copy
Range(Cells(lRow + 1, "A"), Cells(lRow + 1, "S")).Select
Selection.Insert Shift:=xlDown

lRow = lRow + 3
Num = Num - 1

Loop

Application.CutCopyMode = False
Range("A1").Select

End Sub
 
Upvote 0
Solution
Thank you for your feedback
Hi, just need to confirm one thing, so if I am changing my range let's say from 3 rows to 5 rows and column S to V, then what should I change in the code? Thanks!
 
Upvote 0
Hi, just need to confirm one thing, so if I am changing my range let's say from 3 rows to 5 rows and column S to V, then what should I change in the code? Thanks!
Change from:
Range(Cells(2, "A"), Cells(4, "S")).Copy
To:
Range(Cells(2, "A"), Cells(6, "V")).Copy
 
Upvote 0

Forum statistics

Threads
1,215,390
Messages
6,124,667
Members
449,178
Latest member
Emilou

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top