How do I insert 20 rows between each row of text?

G

Guest

I have a two column list of 265 names. I want to insert 20 blank rows between
each name. Is there some easy way to do this? Seems like an easy and somewhat
stupid question. Sorry!
 
G

Gord Dibben

Sub InsertRows()
Application.ScreenUpdating = False
Dim numRows As Integer
Dim r As Long
numRows = 20
For r = 265 To 1 Step -1
ActiveSheet.Rows(r + 1).Resize(numRows).EntireRow.Insert
Next r
Application.ScreenUpdating = True
End Sub

If not familiar with VBA and macros, see David McRitchie's site for more on
"getting started".

http://www.mvps.org/dmcritchie/excel/getstarted.htm

In the meantime..........

First...create a backup copy of your original workbook.

To create a General Module, hit ALT + F11 to open the Visual Basic Editor.

Hit CRTL + r to open Project Explorer.

Find your workbook/project and select it.

Right-click and Insert>Module. Paste the code in there. Save the
workbook and hit ALT + Q to return to your workbook.

Run the macro by going to Tool>Macro>Macros.

You can also assign this macro to a button or a shortcut key combo.


Gord Dibben MS Excel MVP
 
H

Herbert Seidenberg

If you can limit yourself to 254 names
and want an easy way without VBA, then go to
Tools > Options > Custom Lists > Import list from cells, and enter
$A$1:$A$254
Enter the name at A1 into C1 and select it and 20 blank cells
below it. Drag the fill handle down to row 5334.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top