Paste x times

atomazos

New Member
Joined
Jun 26, 2018
Messages
9
Hi how can i copy a value and paste it lets say 10 times underneath with vba?

Thanks,

AAT
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Please explain what you mean by "underneath".
 
Upvote 0
This line of code will copy the value in the active cell to the 10 rows beneath it.
Code:
Range(ActiveCell.Offset(1, 0), ActiveCell.Offset(10, 0)) = ActiveCell
You can also substitute any range or range variable for "ActiveCell".
 
Last edited:
Upvote 0
Another option
Code:
ActiveCell.Copy ActiveCell.Resize(1 * 10)
You can also replace the 10 with the value in another cell like
Code:
ActiveCell.Copy ActiveCell.Resize(1 * Range("C5"))
 
Last edited:
Upvote 0
This line of code will copy the value in the active cell to the 10 rows beneath it.
Code:
Range(ActiveCell.Offset(1, 0), ActiveCell.Offset(10, 0)) = ActiveCell
You can also substitute any range or range variable for "ActiveCell".

Thanks a lot Joe!
 
Upvote 0
Another option
Code:
ActiveCell.Copy ActiveCell.Resize(1 * 10)
You can also replace the 10 with the value in another cell like
Code:
ActiveCell.Copy ActiveCell.Resize(1 * Range("C5"))

Thank you Fulff for your reply
 
Upvote 0
Another option
Code:
ActiveCell.Copy ActiveCell.Resize(1 [B][COLOR="#FF0000"]*[/COLOR][/B] 10)
You can also replace the 10 with the value in another cell like
Code:
ActiveCell.Copy ActiveCell.Resize(1 [B][COLOR="#FF0000"]*[/COLOR][/B] Range("C5"))
Did you mean those asterisks to be plus signs (so that there would be 10 values underneath the ActiveCell)?

If so, another way...

ActiveCell.Resize(1 + 10) = ActiveCell
 
Upvote 0
You are welcome.
Glad we were able to help.
 
Upvote 0

Forum statistics

Threads
1,215,056
Messages
6,122,907
Members
449,096
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