Repeating same range of data

Akakumori

New Member
Joined
Jun 10, 2017
Messages
25
Hello,
How can I dos this?
I want to repeat a range of data which contains 3 colums and 70 rows 20 times.
First colum contains a reference number, same for all 70 rows, second column a vale which doesn't change and third colum the name of 70 different countries.
I want this range to repeat again below by just changing the reference number in the first row for another value I have listed un sheet2.
As many repetitions as references numbers I have un the list of sheet2.

Can someone help me? The task is huge when I have to paste same range like 20 or 50 times when there are lots of references.

Thanks!
 
Last edited:
Try this

VBA Code:
Sub Repeating_range()
  Dim sh1 As Worksheet, c As Range, lr1 As Long, lr3 As Long
  Set sh1 = Sheets("Sheet1")
  With Sheets("Sheet3")
    .Cells.ClearContents
    lr1 = sh1.Range("A" & Rows.Count).End(xlUp).Row
    For Each c In Sheets("Sheet2").Range("A1", Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp))
      lr3 = .Range("A" & Rows.Count).End(xlUp).Row + 1
      .Range("A" & lr3).Resize(lr1, 3).Value = sh1.Range("A1:C" & lr1).Value
      .Range("D" & lr3).Resize(lr1).Value = c.Value
    Next
  End With
End Sub

Thanks so much! It works perfectly!
 
Upvote 0

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Forum statistics

Threads
1,215,339
Messages
6,124,381
Members
449,155
Latest member
ravioli44

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