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

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
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 [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,223,893
Messages
6,175,249
Members
452,623
Latest member
Techenthusiast

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