Copy and paste selected cells a given number of times

- - Latest reply: ac3mark
Posts
12891
Registration date
Monday June 3, 2013
Status
Moderator
Last seen
August 23, 2019
- Jun 19, 2019 at 01:58 PM
Hello,

I had a quick course on macro and I would like to write my first one, but I would need some help with it.

Id like a macro which copies the selected cells to a new worksheet. Id like it to copy under each other as many times, as the user gives in a msgbox.

So far I am at this stage, but cant figure out how to copy them under each other:

Sub Copy_Paste()
' Copy_Paste Macro
Dim i As Integer
Dim j As Integer

Selection.Copy

i = InputBox("Enter number copies to insert", "Paste")

Sheets.Add After:=ActiveSheet
For j = 1 To i
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(1, 0).Select
Next j

Last: Exit Sub

End Sub


Thanks a lot for the help in advance,

A
See more 

1 reply

Posts
12891
Registration date
Monday June 3, 2013
Status
Moderator
Last seen
August 23, 2019
1296
0
Thank you
Offset by your loop counter 'j'.
Respond to ac3mark