X

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

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.

Go to insert and choose Module.

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

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

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

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.

Categories: Excel Tips
Sandra: