Dear all,

I am new to this forum and I apologize for any error in posting this question (right place/ right format etc..).

I am also new to VBA, but I program in C++ and R, so I can follow your hints.

Here's my problem: I have a database in Excel which is formatted in a strange way: three variables repeated many times but with a different number of observations each time, for example...

Variable 1 Variable 2 Variable 3 Variable 1 Variable 2 Variable 3 Variable 1 Variable 2 Variable 3
34 57 21 65 67 89 9 1 20
12 45 68 53 89 32 16 72 14
14 54 87 9 2 4 6 98 24
23 54 98 76 34 90 14 21 65
12 53 87 9 63 97
45 76 76

.. and I need:

Variable 1 Variable 2 Variable 3
34 57 21
12 45 68
14 54 87
23 54 98
65 67 89
53 89 32
9 2 4
76 34 90
12 53 87
45 76 76
9 1 20
16 72 14
6 98 24
14 21 65
9 63 97

Thank you very much for your help!