Take a Guess to Win Windows 10 Pro Key!
previous arrow
next arrow
Slider

How To Use VBA To Insert Blank Row After Every Row In Excel?

Date:2021-7-14 Author:Sandra

In our previous tutorial, we have learned how to insert blank rows in every (alternate) row. But, today, we will get to learn a better and advanced way. if you are familiar with VBA, this method may be very easy for you, if not, that’s fine. just go ahead.

Prepare a sheet and press Alt and F11 to quickly open the VBA box.

How To Use VBA To Insert Blank Row After Every Row In Excel?

Go to insert and choose Module.

How To Use VBA To Insert Blank Row After Every Row In Excel?

Now we type this code in it.

Sub InsertRows()

Dim i As Integer

   For i = 2 To 19 Step 2

       Rows(CInt(i)).Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove

   Next i

End Sub

How To Use VBA To Insert Blank Row After Every Row In Excel?

Press F5 or click on the green triangle to run it.

How To Use VBA To Insert Blank Row After Every Row In Excel?

When we back to the table, you will find it has already inserted a row after each row.

How To Use VBA To Insert Blank Row After Every Row In Excel?

Remember to save this code, you can just copy and paste it when you need it. That’s all for this tutorial. Hope it can really help you a lot.

Copyright Statement: Regarding all of the posts by this website, any copy or use shall get the written permission or authorization from Myofficetricks.

Leave a Reply

Your email address will not be published. Required fields are marked *