View Single Post
  #7  
Old June 18th, 2009, 01:39 PM posted to microsoft.public.excel.worksheet.functions
Dave Peterson
external usenet poster
 
Posts: 19,791
Default insert muliple rows, every 4th row

You'll have to keep track of everything yourself--not for the faint-hearted.

John Walkenbach has some notes:
http://spreadsheetpage.com/index.php...ba_subroutine/

Me...

I save my file before running (sometimes as a new name). Then I can close
without saving if I want to get things back to the way they were.

In testing mode, I'll make several copies of the test sheet and destroy each
with the code. I'll make more copies for more testing.

davisk wrote:

I found a macro from searhing other postings in "General Questions"; thanks
D.Peterson:-) Below is macro previously posted and worked great! I can adjust
the amount of inserted rows, which is EXACTLY what I needed. However, just as
a precautionary, how do I "un-do" the macro if I make a mistake? Or reverse
to delete rows? Thnx, ~k

Sub InsertRows()
Application.ScreenUpdating = False
Dim numRows As Integer
Dim r As Long
r = Cells(Rows.Count, "A").End(xlUp).Row
numRows = 3
For r = r To 1 Step -1
ActiveSheet.Rows(r + 1).Resize(numRows).Insert
Next r
Application.ScreenUpdating = True
End Sub

"davisk" wrote:

I have one column with data down the first 50 rows. I need to insert 3 new
rows for each of the existing rows of data. I failed an attemp using a
formula (mod/row) to sort by 1 and then insert. Does anyone know an easier
way to insure 3 new rows?
Thnx!




--

Dave Peterson