# Insert rows under conditions

#### christopixie

##### New Member
hello guys!
a vba begginer calling from athens greece, using a 2003 MS Office.
my problem is like that: i have almost 6000 rows and 8 columns. data are ordered by two columns B and E.
column B is from 01 to 99 and in each number corresponds amost 80 ordered numbers in column E.
the problem is that numbers in column E do not increase by 1, row after row, as i would like.
so i need to insert rows under each row to make that happen and in these rows there will be data copied from some columns or zeros to the rest of them.

thanx a lot.

### Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a \$25,000 loan, 5% annual interest, 60 month loan.

#### Momentman

##### Well-known Member
Welcome to the forum

If you could just post some sample(fictitious if necessary) data showing us the before(the code runs) and after results, that would help

#### christopixie

##### New Member
 BEFORE A B C D E F G H 1 year groups code 1 code 2 age m f total 2 2013 01 D 45 103 2 1 3 3 2013 01 D 45 106 0 2 2 4 2013 02 B 32 3 4 1 5 5 2013 02 B 32 6 3 2 5 AFTER 1 2013 01 D 45 103 2 1 3 2 2013 01 D 45 104 0 0 0 3 2013 01 D 45 105 0 0 0 4 2013 01 D 45 106 0 2 2 5 2103 02 B 32 00 0 0 0 6 2013 02 B 32 01 0 0 0 7 2013 02 B 32 02 0 0 0 8 2013 02 B 32 03 4 1 5 9 2013 02 B 32 04 0 0 0 10 2013 02 B 32 05 0 0 0 11 2013 02 B 32 06 5 2 5

<tbody>
</tbody>

NOotice that data are sorted 1st by column B and 2nd by column E and we must have a perfect numbering in col E from 0 to the largest age for each GROUP in column B.

columns a,b,c,d of the inserted Lines 2 and3 take values from GROUP 01of col b
whereas inserted Lines 5,6,7,9,10 take values from GROUP 02 of column b.
columns F, G, H of the inserted Lines they all take 0.

Replies
4
Views
164
Replies
0
Views
21
Replies
1
Views
55
Replies
2
Views
38
Replies
10
Views
136