Inserting alternate blank rows in Excel

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have several spreadsheets with between 2,000 and 3,000 rows of data. I'm
using them to import data into some accounting software. The format required
by the software is that each row of data is separated by a blank row. Short
of individually inserting several thousand rows, does anyone know another way
of changing the layout of the spreadsheet?
 
Well, you could add a helper column and enter 1, 3, 5, and copy down to
the bottom of what you've got. You could then put 2,4,6,8 ... in blank rows
until you have the max # of what you need. Then sort by the helper column.
Make sure you save a pristine copy and operate on a secondary copy so you
don't damage your good file.
 
Here is a macro you can use. It's loosly written so it may take a minute to
run if the file is large.
Copy the code into a module in the Visual Basic Editor (Alt F11 to open
VBE). Then the macro InsertRows will be available when you select Tools,
Macro, Macros (or Alt F8).

Sub InsertRows()

intRow = Cells.SpecialCells(xlCellTypeLastCell).Row
For i = intRow To 1 Step -1
Rows(i).EntireRow.Insert
Next i

End Sub
 
I just tried running this macro but, I receive the below message:

can't execute code in break module

what am I doint wrong?

CJ
 
The actual message would read "cannot execute code in break mode"

Means you are in break mode and must reset.

Alt + F11 to get to VBE.

On Toolbar select Run>Reset

How you got into break mode is the question you should try to answer.

Run the macro again to see what happens.


Gord Dibben MS Excel MVP
 
Back
Top