View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Norman Jones
 
Posts: n/a
Default Inserting multiple non-consecutive rows

Hi Piper,

I have spreadsheet populated with 200 names. I need to insert 2
blank rows between each name. I know how to manually insert
blank rows. But, is there a quicker, more efficient way to do this?


Try:
'=============
Public Sub Tester()
Dim WB As Workbook
Dim SH As Worksheet
Dim Rng As Range
Dim LRow As Long
Dim i As Long
Dim CalcMode As Long

Set WB = Workbooks("YourBook.xls") '<<===== CHANGE
Set SH = WB.Sheets("Sheet1") '<<===== CHANGE

On Error GoTo XIT
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

LRow = Cells(Rows.Count, "A").End(xlUp).Row

For i = LRow To 1 Step -1
Rows(i + 1).Resize(2).Insert
Next i

XIT:
With Application
.Calculation = CalcMode
.ScreenUpdating = True
End With
End Sub
'<<=============

If you are not familiar with macros, you may wish to visit David McRitchie's
'Getting Started With Macros And User Defined Functions' at:

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


---
Regards,
Norman


"piper1963" wrote in message
...
I have spreadsheet populated with 200 names. I need to insert 2 blank rows
between each name. I know how to manually insert blank rows. But, is
there
a quicker, more efficient way to do this? Thank you!