Copy Range "x" number of times

GRCArizona

Board Regular
Joined
Apr 24, 2010
Messages
92
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
 

Some videos you may like

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
19,766
Office Version
  1. 2016
  2. 2013
  3. 2007
Platform
  1. Windows
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
 

GRCArizona

Board Regular
Joined
Apr 24, 2010
Messages
92
Works perfect! Thanks a bunch Michael M. You saved me a ton of time and file size!
 

Watch MrExcel Video

Forum statistics

Threads
1,123,133
Messages
5,599,912
Members
414,347
Latest member
tbanack

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
Top