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

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
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,215,054
Messages
6,122,893
Members
449,097
Latest member
dbomb1414

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