PeterH
PeterH

Reputation: 1040

Duplicate row above on multiple lines

I want to be able to make a selection in Excel, then run a macro that will duplicate the above row in to all the rows below.

This:

enter image description here

Would become:

enter image description here

I can do this for just one row using CTR + D, but I want to be able to do it for 100s of rows at a time with a macro.

My starting point was this:

Sub DuplicateRow()
    Selection.FillDown
End Sub

Upvotes: 0

Views: 371

Answers (1)

Edward
Edward

Reputation: 8606

If you really want to do it with VBA macro:

   Sub CopyDown()
    Selection.Rows(1).Offset(-1, 0).Copy
    Selection.PasteSpecial
    Application.CutCopyMode = False
   End Sub

Upvotes: 2

Related Questions