View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default INSERTING COPIED ROWS

You cannot insert at multiple locations as you have found out.

Also you cannot insert three rows after every other row on a sheet.

Excel will squawk about "cannot shift objects off sheet"

You could do it for a range that would not reach to the bottom of the sheet.

Here is a macro to insert 3 blank rows every second row 1000 times.

Sub InsertRows()
Application.ScreenUpdating = False
Dim numRows As Integer
Dim r As Long
numRows = 3
For r = 1000 To 1 Step -2
ActiveSheet.Rows(r + 1).Resize(numRows).EntireRow.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 Wed, 5 Mar 2008 14:55:01 -0800, rgodchaux
wrote:

I need to copy 3 blank rows and insert them in every other row on the sheet.
Is there a way to insert multiple copied cells into multiple locations at one
time? Excel gives me the command cannot be performed with multiple
selections please select a single range error.