View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Inserting several new rows

Sub Insert_Some_Rows()
Application.ScreenUpdating = False
Dim numRows As Integer
Dim R As Long
numRows = InputBox("Enter number of blank rows to insert")
R = Cells(Rows.Count, "A").End(xlUp).Row
For R = R To 1 Step -1
ActiveSheet.Rows(R + 1).Resize(numRows).Insert
Next R
Application.ScreenUpdating = True
End Sub

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

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

or Ron de De Bruin's site on where to store macros.

http://www.rondebruin.nl/code.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 InsertModule. Paste the code in there. Save the
workbook and hit ALT + Q to return to your workbook.

Run or edit the macro by going to ToolMacroMacros.

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


Gord Dibben MS Excel MVP

On Thu, 17 Jan 2008 15:00:02 -0800, richzip
wrote:

I have a spreadsheet with about 1500 rows. I want to insert 18 black rows
after each existing row. Is there a quick way of doing this without having
to do this after each row?