Hello, I am seeking assistance in writing a macro to help me line up data. The attached Excel file shows an example of what I have and what I want.
Columns A:C are from 2017. Columns D:F are from 2018, just pasted next to it. I have the same variables in each year (Variable1, Variable2, Variable3...) in the same order for each year.
The number of items in each table is not always the same. For example, 2017 Variable1 has "Yes". 2018 Variable1 has "Yes", "No". I want Variable2 to start on the same line.
I've searched many forums and found ways to line up individual rows, I'm not sure how to write the code so it will just line up that first row of the table. There are more than 100 tables, so inserting/deleting the rows manually isn't an option.
Thank you for your help!
[TABLE="width: 360"]
<tbody>[TR]
[TD]Have:[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]2017[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Variable1[/TD]
[TD]Percent[/TD]
[TD][/TD]
[TD]Variable1[/TD]
[TD]Percent[/TD]
[/TR]
[TR]
[TD]Yes[/TD]
[TD]100.00[/TD]
[TD][/TD]
[TD]Yes[/TD]
[TD]95.24[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]No[/TD]
[TD]4.76190476[/TD]
[/TR]
[TR]
[TD]Variable2[/TD]
[TD]Percent[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Yes[/TD]
[TD]0.28[/TD]
[TD][/TD]
[TD]Variable2[/TD]
[TD]Percent[/TD]
[/TR]
[TR]
[TD]No[/TD]
[TD]99.72[/TD]
[TD][/TD]
[TD]Yes[/TD]
[TD]0.33[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]No[/TD]
[TD]94.9968334[/TD]
[/TR]
[TR]
[TD]Variable3[/TD]
[TD]Percent[/TD]
[TD][/TD]
[TD]Maybe[/TD]
[TD]5.14[/TD]
[/TR]
[TR]
[TD]Option 1[/TD]
[TD]0.56[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Option 2[/TD]
[TD]99.4357296[/TD]
[TD][/TD]
[TD]Variable3[/TD]
[TD]Percent[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Option 1[/TD]
[TD]0.46[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Option 2[/TD]
[TD]75.99[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Option 3[/TD]
[TD]20.69[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Option 4[/TD]
[TD]2.86[/TD]
[/TR]
[TR]
[TD]Want:[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]2017[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Variable1[/TD]
[TD]Percent[/TD]
[TD][/TD]
[TD]Variable1[/TD]
[TD]Percent[/TD]
[/TR]
[TR]
[TD]Yes[/TD]
[TD]100.00[/TD]
[TD][/TD]
[TD]Yes[/TD]
[TD]95.24[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]No[/TD]
[TD]4.76190476[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Variable2[/TD]
[TD]Percent[/TD]
[TD][/TD]
[TD]Variable2[/TD]
[TD]Percent[/TD]
[/TR]
[TR]
[TD]Yes[/TD]
[TD]0.28[/TD]
[TD][/TD]
[TD]Yes[/TD]
[TD]0.33[/TD]
[/TR]
[TR]
[TD]No[/TD]
[TD]99.72[/TD]
[TD][/TD]
[TD]No[/TD]
[TD]94.9968334[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Maybe[/TD]
[TD]5.14[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Variable3[/TD]
[TD]Percent[/TD]
[TD][/TD]
[TD]Variable3[/TD]
[TD]Percent[/TD]
[/TR]
[TR]
[TD]Option 1[/TD]
[TD]0.56[/TD]
[TD][/TD]
[TD]Option 1[/TD]
[TD]0.46[/TD]
[/TR]
[TR]
[TD]Option 2[/TD]
[TD]99.4357296[/TD]
[TD][/TD]
[TD]Option 2[/TD]
[TD]75.99[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Option 3[/TD]
[TD]20.69[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Option 4[/TD]
[TD]2.86[/TD]
[/TR]
</tbody>[/TABLE]
Columns A:C are from 2017. Columns D:F are from 2018, just pasted next to it. I have the same variables in each year (Variable1, Variable2, Variable3...) in the same order for each year.
The number of items in each table is not always the same. For example, 2017 Variable1 has "Yes". 2018 Variable1 has "Yes", "No". I want Variable2 to start on the same line.
I've searched many forums and found ways to line up individual rows, I'm not sure how to write the code so it will just line up that first row of the table. There are more than 100 tables, so inserting/deleting the rows manually isn't an option.
Thank you for your help!
[TABLE="width: 360"]
<tbody>[TR]
[TD]Have:[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]2017[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Variable1[/TD]
[TD]Percent[/TD]
[TD][/TD]
[TD]Variable1[/TD]
[TD]Percent[/TD]
[/TR]
[TR]
[TD]Yes[/TD]
[TD]100.00[/TD]
[TD][/TD]
[TD]Yes[/TD]
[TD]95.24[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]No[/TD]
[TD]4.76190476[/TD]
[/TR]
[TR]
[TD]Variable2[/TD]
[TD]Percent[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Yes[/TD]
[TD]0.28[/TD]
[TD][/TD]
[TD]Variable2[/TD]
[TD]Percent[/TD]
[/TR]
[TR]
[TD]No[/TD]
[TD]99.72[/TD]
[TD][/TD]
[TD]Yes[/TD]
[TD]0.33[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]No[/TD]
[TD]94.9968334[/TD]
[/TR]
[TR]
[TD]Variable3[/TD]
[TD]Percent[/TD]
[TD][/TD]
[TD]Maybe[/TD]
[TD]5.14[/TD]
[/TR]
[TR]
[TD]Option 1[/TD]
[TD]0.56[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Option 2[/TD]
[TD]99.4357296[/TD]
[TD][/TD]
[TD]Variable3[/TD]
[TD]Percent[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Option 1[/TD]
[TD]0.46[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Option 2[/TD]
[TD]75.99[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Option 3[/TD]
[TD]20.69[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Option 4[/TD]
[TD]2.86[/TD]
[/TR]
[TR]
[TD]Want:[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]2017[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]2018[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Variable1[/TD]
[TD]Percent[/TD]
[TD][/TD]
[TD]Variable1[/TD]
[TD]Percent[/TD]
[/TR]
[TR]
[TD]Yes[/TD]
[TD]100.00[/TD]
[TD][/TD]
[TD]Yes[/TD]
[TD]95.24[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]No[/TD]
[TD]4.76190476[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Variable2[/TD]
[TD]Percent[/TD]
[TD][/TD]
[TD]Variable2[/TD]
[TD]Percent[/TD]
[/TR]
[TR]
[TD]Yes[/TD]
[TD]0.28[/TD]
[TD][/TD]
[TD]Yes[/TD]
[TD]0.33[/TD]
[/TR]
[TR]
[TD]No[/TD]
[TD]99.72[/TD]
[TD][/TD]
[TD]No[/TD]
[TD]94.9968334[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Maybe[/TD]
[TD]5.14[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Variable3[/TD]
[TD]Percent[/TD]
[TD][/TD]
[TD]Variable3[/TD]
[TD]Percent[/TD]
[/TR]
[TR]
[TD]Option 1[/TD]
[TD]0.56[/TD]
[TD][/TD]
[TD]Option 1[/TD]
[TD]0.46[/TD]
[/TR]
[TR]
[TD]Option 2[/TD]
[TD]99.4357296[/TD]
[TD][/TD]
[TD]Option 2[/TD]
[TD]75.99[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Option 3[/TD]
[TD]20.69[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Option 4[/TD]
[TD]2.86[/TD]
[/TR]
</tbody>[/TABLE]