Copy Range "x" number of times

GRCArizona

Board Regular
Joined
Apr 24, 2010
Messages
95
Hi - I'm having trouble with VBA. I've got a drop down where a user can select 1-10, and this answer will copy a range this # of time. The range to copy is C4:G20.

For example: If a user selects "3", I'd like to copy this range 3 times. The first copy would be pasted into row 23 (IE: C23:G39), and the next copy would paste in row 42 (IE: C42:G58). Is there a way to have the row source be dynamic enough to account for this?

I'm not sure whether to use Select Case or For / Next.

any suggestions would be greatly appreciated.

thx,

gRC
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
how about this, assuming your dropdown list is in cell "A1"
Code:
Sub MM1()
Dim lr As Long
lr = Cells(Rows.Count, "C").End(xlUp).Row
Set x = Range("A1") 'where the dropdown value lives, change to suit
Do Until x = 0
Range("C4:G20").Copy Destination:=Range("C" & lr + 1)
lr = Cells(Rows.Count, "C").End(xlUp).Row
x = x - 1
Loop
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,812
Messages
6,121,693
Members
449,048
Latest member
81jamesacct

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