Hi, I am writing a code where the complete row where the active cell is should be copied and pasted in a new row under. The code is below. The issue is that is copies the row that has the active cell, but also all rows below it. I guess it is because the active cell is being moved down. How can this be done correctly?
And, how should the code be if the same row should be pasted 2 times?
SubCopyRowBelowOneTime()
Dim myCell
Set myCell = ActiveCell
While ActiveCell.Value <> ""
Rows(ActiveCell.Row).Select
Selection.Copy
Selection.Insert Shift:=xlDown
myCell.Offset(1, 0).Select
Set myCell = ActiveCell
Wend
End Sub
And, how should the code be if the same row should be pasted 2 times?
SubCopyRowBelowOneTime()
Dim myCell
Set myCell = ActiveCell
While ActiveCell.Value <> ""
Rows(ActiveCell.Row).Select
Selection.Copy
Selection.Insert Shift:=xlDown
myCell.Offset(1, 0).Select
Set myCell = ActiveCell
Wend
End Sub