inserting rows

R

ROLG

i need some advice as to the following: i have a column with about 400
rows
of information--i need to copy two consecutive rows into the colum
after every 14th row. the first two rows would be inserted after ro
14--then fourteen rows
after these insertions-enter two more rows etc down to the end..

hope that this is clear. i would like to thank the people that have
been helping me - you have made things a lot easier and clearer
 
D

David McRitchie

Hi ....,
You cannot do that with Excel alone, you would need a macro.
Since you did not post to microsoft.public.excel.programming,
I expect you need instructions to install and invoke a macro
http://www.mvps.org/dmcritchie/excel/getstarted.htm
Posting directly to a newsgroup would probably be a lot better.
http://www.mvps.org/dmcritchie/excel/xlnews.htm#posting

Sub Copy_1_2_Every12()
ActiveSheet.Copy After:=Sheets(Sheets.Count)
Dim i As Long, LastRow As Long, M As Long
LastRow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
M = LastRow - ((LastRow - 2) Mod 12) + 1
If M = 1 + LastRow Then M = M - 12 'No header after end
For i = M To 14 Step -12
Rows("1:2").Select
Range(i & ":" & (i + 1)).Insert Shift:=xlDown
Selection.Copy
Cells(i, 1).Select
Selection.PasteSpecial Paste:=xlAll, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Rows(i).PageBreak = xlManual 'expect you want page breaks
Next i
End Sub
 

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