how do I add rows to a very large spreadsheet

E

excelmam

I have an excel question. I have a huge spreadsheet that I need to insert two
blank lines after every two lines. Then I need to insert a formula on those
two blank lines.
Does anyone know how I might save time and complete this task w/o adding it
in manually after every two lines.
 
H

Harald Staff

Hi

This is what a macro does. But you'd need to know how to write a macro that
does this. Or have someone else write it. But this person would need an
awfully detailed description of this task., like which row numbers, what is
in the cells where, which exact formula should go where and why, ... If you
can describe this, post it in microsoft.public.excel.programming for
suggestions.

HTH. Best wishes Harald
 
D

dominicb

Good evening Excelmam

Good news and bad news. The good news is, inserting two blank lines
after each line is pretty easy. The formula bit isn't. The code below
will take a block of data 150 lines long and add two blank rows after
each line, making it 450 lines long. You haven't given much info here,
so I don't know how many lines you are trying to work on:

Sub Test()
For f = 1 To 150 Step 2
Rows(f).Select
Selection.Insert Shift:=xlDown
f = f + 1
Rows(f).Select
Selection.Insert Shift:=xlDown
ActiveSheet.Paste
Next f
End Sub

The code is a little bit messy I know, but for a one off job it will do
the trick. I'll have to think a bit harder about the formulae bit, but
you'll need to supply more information, like what the formulae are
going to be, how many, etc...?

HTH

DominicB
 
Top