Home All Groups Group Topic Archive Search About
Author
18 Aug 2010 4:04 AM
chris smith
my worksheet has info in every row.  I would like to insert a blank row
between each without doing it manually.  Can someone help?

Author
18 Aug 2010 4:48 AM
GS
chris smith wrote on 8/18/2010 :
> my worksheet has info in every row.  I would like to insert a blank row
> between each without doing it manually.  Can someone help?

This greoup is for VB6 and earlier. This sounds like a question for the
Excel programming group. If you're automating Excel from a VB.exe then
provide more info.

Otherwise, start from the last row and work up to the first row you
want to insert a blank row before. Make sure you get a row count before
you begin so you can ref each existing non-blank row.

<air code>
For r = RowCount To FirstRow Step - 1
  Cells(r).EntireRow.Insert Shift:=xlDown
Next r

So if there's 20 rows to begin with, the first blank row will be
inserted at row20; existing (row20) shifts down to row21 and the
inserted row is now row20. The next insert position is row19 and so the
process repeats all the way up to Row(FirstRow).

HTH

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc