Adding specific rows in Excel with VBA

Copper Contributor

Hello everyone,
I am trying to create a macro that adds specific rows in Excel/at a specific position. For visualization see screenshot below.
Basically what I´m trying to do is by clicking "button 3" I want Excel to add the rows 9-11 (see highlight in green-ish) as of line 13 with the same formatting plus the dropw-down field (highlighted in organge). Obviously, when clicking "button 3" again the three rows should be added as of row 17. The idea would be to have one row in between.

Thanks a lot in advance for your support - much appreciated.screenshot.png

 

2 Replies

@Florian_Reitbauer3107 

 

Sub Button3_Click()
    Dim r As Range
    Set r = Range("A" & Rows.Count).End(xlUp).Offset(2)
    Range("A9:J11").Copy Destination:=r
    Application.CutCopyMode = xlCopy
End Sub

@Hans Vogelaar : fantastic - thanks a lot