Excel VBA: How to combine cells in a "simple combination" fashion : I've looked for a way to do this in several foruns and websites, but found no clue...
Hope someone can help me! 

Here is a sample of the data I have:

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-html -->

    <div class="cms_table"><table class="cms_table_sheet0 cms_table_gridlines"><tr valign="top" class="cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_row0 cms_table_sheet0_td cms_table_gridlines_td">Student1</TD>
    <TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_row0 cms_table_sheet0_td cms_table_gridlines_td">Student2</TD>
    <TD class="cms_table_column2 cms_table_style0 cms_table_s cms_table_row0 cms_table_sheet0_td cms_table_gridlines_td">Student3</TD>
    <TD class="cms_table_column3 cms_table_row0 cms_table_sheet0_td cms_table_gridlines_td">Student4</TD>
    </tr>
    <tr valign="top" class="cms_table_row0 cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row0_td">Nascimento MS</TD>
    <TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row0_td"> Espindola CF</TD>
    <TD class="cms_table_column2 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row0_td"> do Prado C</TD>
    <TD class="cms_table_column3 cms_table_sheet0_td cms_table_gridlines_td cms_table_row0_td"></TD>
    </tr>
    <tr valign="top" class="cms_table_row1 cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row1_td">Bhansali S</TD>
    <TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row1_td">Nascimento MS</TD>
    <TD class="cms_table_column2 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row1_td"> Dhawan V</TD>
    <TD class="cms_table_column3 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row1_td"> Amarins MB</TD>
    </tr>
    <tr valign="top" class="cms_table_row2 cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row2_td">Bozek T</TD>
    <TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row2_td"> Blazekovic A</TD>
    <TD class="cms_table_column2 cms_table_sheet0_td cms_table_gridlines_td cms_table_row2_td"></TD>
    <TD class="cms_table_column3 cms_table_sheet0_td cms_table_gridlines_td cms_table_row2_td"></TD>
    </tr>
    <tr valign="top" class="cms_table_row3 cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row3_td">Thewjitcharoen Y</TD>
    <TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row3_td">Nascimento MS</TD>
    <TD class="cms_table_column2 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row3_td">do Prado C</TD>
    <TD class="cms_table_column3 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row3_td"> Nakasatien S</TD>
    </tr>
    <tr valign="top" class="cms_table_row4 cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row4_td">Jonas MI</TD>
    <TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row4_td">Bhansali S</TD>
    <TD class="cms_table_column2 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row4_td">Amarins MB</TD>
    <TD class="cms_table_column3 cms_table_sheet0_td cms_table_gridlines_td cms_table_row4_td"></TD>
    </tr>
    </table></div>

<!-- end snippet -->


I want an arrangement of these cells, outputting pairs that reflect how many times a particular student interacted in these groups.
In other words, it is a simple combination. For each group, there are n!/p!*(n-p)! possibilities of interaction, where "n" is the number of the students in each group (in the sample, ranging from 2 to 4) and "p" equals 2 (pairs of interaction). Note that each array of students has a different number of students.

Thus, the output would be something like this:

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-html -->

    <div class="cms_table"><table class="cms_table_sheet0 cms_table_gridlines"><tr valign="top" class="cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_row0 cms_table_sheet0_td cms_table_gridlines_td">Nascimento MS</TD>
    <TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_row0 cms_table_sheet0_td cms_table_gridlines_td">Espindola CF</TD>
    </tr>
    <tr valign="top" class="cms_table_row0 cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row0_td">Nascimento MS</TD>
    <TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row0_td">do Prado C</TD>
    </tr>
    <tr valign="top" class="cms_table_row1 cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row1_td">Espindola CF</TD>
    <TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_sheet0_td cms_table_gridlines_td cms_table_row1_td">do Prado C</TD>
    </tr>
    <tr valign="top" class="cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Bhansali S</TD>
    <TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Nascimento MS</TD>
    </tr>
    <tr valign="top" class="cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Bhansali S</TD>
    <TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Dhawan V</TD>
    </tr>
    <tr valign="top" class="cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Bhansali S</TD>
    <TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Amarins MB</TD>
    </tr>
    <tr valign="top" class="cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Nascimento MS</TD>
    <TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Dhawan V</TD>
    </tr>
    <tr valign="top" class="cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Nascimento MS</TD>
    <TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Amarins MB</TD>
    </tr>
    <tr valign="top" class="cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Dhawan V</TD>
    <TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Amarins MB</TD>
    </tr>
    <tr valign="top" class="cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Bozek T</TD>
    <TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Blazekovic A</TD>
    </tr>
    <tr valign="top" class="cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Thewjitcharoen Y</TD>
    <TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Nascimento MS</TD>
    </tr>
    <tr valign="top" class="cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Thewjitcharoen Y</TD>
    <TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">do Prado C</TD>
    </tr>
    <tr valign="top" class="cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Thewjitcharoen Y</TD>
    <TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Nakasatien S</TD>
    </tr>
    <tr valign="top" class="cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Nascimento MS</TD>
    <TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">do Prado C</TD>
    </tr>
    <tr valign="top" class="cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Nascimento MS</TD>
    <TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Nakasatien S</TD>
    </tr>
    <tr valign="top" class="cms_table_sheet0_tr cms_table_gridlines_tr"><TD class="cms_table_column0 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">do Prado C</TD>
    <TD class="cms_table_column1 cms_table_style0 cms_table_s cms_table_row1 cms_table_sheet0_td cms_table_gridlines_td">Nakasatien S</TD>
    </tr>
    </table></div>

<!-- end snippet -->

...and so on...


It is my first post, but I hope I made it clear enough. 