Hi Guys
I am looking for some help with finding some content within a column and re-arranging the order of the found rows to a specific order.
To make it a bit clearer please see below
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD]score1[/TD]
[TD]score2[/TD]
[TD]score3[/TD]
[TD]score4[/TD]
[TD]score5[/TD]
[TD]score6[/TD]
[TD]score7[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]text[/TD]
[TD]text[/TD]
[TD]text[/TD]
[TD]text[/TD]
[TD]text[/TD]
[TD]text[/TD]
[TD]text[/TD]
[/TR]
[TR]
[TD]123[/TD]
[TD]red[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[/TR]
[TR]
[TD]124[/TD]
[TD]blu[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[/TR]
[TR]
[TD]125[/TD]
[TD]grn[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[/TR]
[TR]
[TD]126[/TD]
[TD]ora[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[/TR]
[TR]
[TD]127[/TD]
[TD]bla[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]tom[/TD]
[TD]code1[/TD]
[TD]code1[/TD]
[TD]code1[/TD]
[TD]code1[/TD]
[TD]code1[/TD]
[TD]code1[/TD]
[TD]code1[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]ann[/TD]
[TD]code2[/TD]
[TD]code2[/TD]
[TD]code2[/TD]
[TD]code2[/TD]
[TD]code2[/TD]
[TD]code2[/TD]
[TD]code2[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]alan[/TD]
[TD]code3[/TD]
[TD]code3[/TD]
[TD]code3[/TD]
[TD]code3[/TD]
[TD]code3[/TD]
[TD]code3[/TD]
[TD]code3[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]ellie[/TD]
[TD]code4[/TD]
[TD]code4[/TD]
[TD]code4[/TD]
[TD]code4[/TD]
[TD]code4[/TD]
[TD]code4[/TD]
[TD]code4[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]mary[/TD]
[TD]code5[/TD]
[TD]code5[/TD]
[TD]code5[/TD]
[TD]code5[/TD]
[TD]code5[/TD]
[TD]code5[/TD]
[TD]code5[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]dave[/TD]
[TD]code6[/TD]
[TD]code6[/TD]
[TD]code6[/TD]
[TD]code6[/TD]
[TD]code6[/TD]
[TD]code6[/TD]
[TD]code6[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]lee[/TD]
[TD]code7[/TD]
[TD]code7[/TD]
[TD]code7[/TD]
[TD]code7[/TD]
[TD]code7[/TD]
[TD]code7[/TD]
[TD]code7[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
The cells I need to reorder will always be in column 2 and will always be in the same order starting with "tom" and ending with "lee"
I would like to run a macro to find the relevant rows and all the relevant columns to the right and reorder them in the following order
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]ann[/TD]
[TD]code2[/TD]
[TD]code2[/TD]
[TD]code2[/TD]
[TD]code2[/TD]
[TD]code2[/TD]
[TD]code2[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]mary[/TD]
[TD]code5[/TD]
[TD]code5[/TD]
[TD]code5[/TD]
[TD]code5[/TD]
[TD]code5[/TD]
[TD]code5[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]ellie[/TD]
[TD]code4[/TD]
[TD]code4[/TD]
[TD]code4[/TD]
[TD]code4[/TD]
[TD]code4[/TD]
[TD]code4[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]alan[/TD]
[TD]code3[/TD]
[TD]code3[/TD]
[TD]code3[/TD]
[TD]code3[/TD]
[TD]code3[/TD]
[TD]code3[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]tom[/TD]
[TD]code1[/TD]
[TD]code1[/TD]
[TD]code1[/TD]
[TD]code1[/TD]
[TD]code1[/TD]
[TD]code1[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]lee[/TD]
[TD]code7[/TD]
[TD]code7[/TD]
[TD]code7[/TD]
[TD]code7[/TD]
[TD]code7[/TD]
[TD]code7[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]dave[/TD]
[TD]code6[/TD]
[TD]code6[/TD]
[TD]code6[/TD]
[TD]code6[/TD]
[TD]code6[/TD]
[TD]code6[/TD]
[/TR]
</tbody>[/TABLE]
in the above examples the cells with code1, code2 are for example only, in reality they will be various numbers.
Hope this makes sense
Thanks for any help
I am looking for some help with finding some content within a column and re-arranging the order of the found rows to a specific order.
To make it a bit clearer please see below
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD]score1[/TD]
[TD]score2[/TD]
[TD]score3[/TD]
[TD]score4[/TD]
[TD]score5[/TD]
[TD]score6[/TD]
[TD]score7[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]text[/TD]
[TD]text[/TD]
[TD]text[/TD]
[TD]text[/TD]
[TD]text[/TD]
[TD]text[/TD]
[TD]text[/TD]
[/TR]
[TR]
[TD]123[/TD]
[TD]red[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[/TR]
[TR]
[TD]124[/TD]
[TD]blu[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[/TR]
[TR]
[TD]125[/TD]
[TD]grn[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[/TR]
[TR]
[TD]126[/TD]
[TD]ora[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[/TR]
[TR]
[TD]127[/TD]
[TD]bla[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[TD]number[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]tom[/TD]
[TD]code1[/TD]
[TD]code1[/TD]
[TD]code1[/TD]
[TD]code1[/TD]
[TD]code1[/TD]
[TD]code1[/TD]
[TD]code1[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]ann[/TD]
[TD]code2[/TD]
[TD]code2[/TD]
[TD]code2[/TD]
[TD]code2[/TD]
[TD]code2[/TD]
[TD]code2[/TD]
[TD]code2[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]alan[/TD]
[TD]code3[/TD]
[TD]code3[/TD]
[TD]code3[/TD]
[TD]code3[/TD]
[TD]code3[/TD]
[TD]code3[/TD]
[TD]code3[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]ellie[/TD]
[TD]code4[/TD]
[TD]code4[/TD]
[TD]code4[/TD]
[TD]code4[/TD]
[TD]code4[/TD]
[TD]code4[/TD]
[TD]code4[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]mary[/TD]
[TD]code5[/TD]
[TD]code5[/TD]
[TD]code5[/TD]
[TD]code5[/TD]
[TD]code5[/TD]
[TD]code5[/TD]
[TD]code5[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]dave[/TD]
[TD]code6[/TD]
[TD]code6[/TD]
[TD]code6[/TD]
[TD]code6[/TD]
[TD]code6[/TD]
[TD]code6[/TD]
[TD]code6[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]lee[/TD]
[TD]code7[/TD]
[TD]code7[/TD]
[TD]code7[/TD]
[TD]code7[/TD]
[TD]code7[/TD]
[TD]code7[/TD]
[TD]code7[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
The cells I need to reorder will always be in column 2 and will always be in the same order starting with "tom" and ending with "lee"
I would like to run a macro to find the relevant rows and all the relevant columns to the right and reorder them in the following order
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]ann[/TD]
[TD]code2[/TD]
[TD]code2[/TD]
[TD]code2[/TD]
[TD]code2[/TD]
[TD]code2[/TD]
[TD]code2[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]mary[/TD]
[TD]code5[/TD]
[TD]code5[/TD]
[TD]code5[/TD]
[TD]code5[/TD]
[TD]code5[/TD]
[TD]code5[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]ellie[/TD]
[TD]code4[/TD]
[TD]code4[/TD]
[TD]code4[/TD]
[TD]code4[/TD]
[TD]code4[/TD]
[TD]code4[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]alan[/TD]
[TD]code3[/TD]
[TD]code3[/TD]
[TD]code3[/TD]
[TD]code3[/TD]
[TD]code3[/TD]
[TD]code3[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]tom[/TD]
[TD]code1[/TD]
[TD]code1[/TD]
[TD]code1[/TD]
[TD]code1[/TD]
[TD]code1[/TD]
[TD]code1[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]lee[/TD]
[TD]code7[/TD]
[TD]code7[/TD]
[TD]code7[/TD]
[TD]code7[/TD]
[TD]code7[/TD]
[TD]code7[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]dave[/TD]
[TD]code6[/TD]
[TD]code6[/TD]
[TD]code6[/TD]
[TD]code6[/TD]
[TD]code6[/TD]
[TD]code6[/TD]
[/TR]
</tbody>[/TABLE]
in the above examples the cells with code1, code2 are for example only, in reality they will be various numbers.
Hope this makes sense
Thanks for any help
Last edited: