Merge cells with different value into one row

Closed
Tanca - Jul 15, 2015 at 06:13 AM
Hello all,

I would like to do a VB macro in MS Excel 2010 which will do the following:

Before applying macro:

Row Number Year Code Description
Row1 2 2014 20001 CPV code 20001
Row2 2 2014 20002 CPV code 20002
Row3 2 2014 20003 CPV code 20003
Row4 5 2015 50001 CPV code 50001
Row5 5 2015 50002 CPV code 50002

After applying macro I would like to have only 2 rows out of this, not 5 rows:

Row Number Year Code Description
Row 1 2 2014 20001 CPV code 20001
20002 CPV code 20002
20003 CPV code 20003
Row 2 5 2015 50001 CPV code 50001
50002 CPV code 50002

It means values of code (20001, 20002, 20003) are written below each other into 1 cell only (not 3 rows merged), also its description is written into 1 cell, the same for codes 50001, 50002.

Any idea on how to proceed?

Many thanks,
Tanca