OK, I'm need help. I took on a project over my head and I am close to finishing. I just need help on one thing. My project involves Access generating a Cross-Tab query and exporting to Excel. Once it gets to Excel, I need to insert a row and subtotal based on name in column A:
For Example:
[TABLE="width: 527"]
<tbody>[TR]
[TD]Name[/TD]
[TD]XXX[/TD]
[TD]XXX[/TD]
[TD]Week 1[/TD]
[TD]Week 2[/TD]
[TD]Week 3[/TD]
[TD]Week 4[/TD]
[TD]Week 5[/TD]
[/TR]
[TR]
[TD]Doe, John[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]40[/TD]
[TD="align: right"]50[/TD]
[TD="align: right"]32[/TD]
[TD="align: right"]25[/TD]
[TD="align: right"]11[/TD]
[/TR]
[TR]
[TD]Doe, John[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]17[/TD]
[TD="align: right"]25[/TD]
[TD="align: right"]13[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]23[/TD]
[/TR]
[TR]
[TD]Smith, Larry[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]32[/TD]
[TD="align: right"]45[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]22[/TD]
[TD="align: right"]14[/TD]
[/TR]
[TR]
[TD]Smith, Larry[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]11[/TD]
[TD="align: right"]14[/TD]
[TD="align: right"]22[/TD]
[TD="align: right"]11[/TD]
[TD="align: right"]7[/TD]
[/TR]
</tbody>[/TABLE]
Final product would look like:
[TABLE="width: 527"]
<tbody>[TR]
[TD]Name[/TD]
[TD]XXX[/TD]
[TD]XXX[/TD]
[TD]Week 1[/TD]
[TD]Week 2[/TD]
[TD]Week 3[/TD]
[TD]Week 4[/TD]
[TD]Week 5[/TD]
[/TR]
[TR]
[TD]Doe, John[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]40[/TD]
[TD="align: right"]50[/TD]
[TD="align: right"]32[/TD]
[TD="align: right"]25[/TD]
[TD="align: right"]11[/TD]
[/TR]
[TR]
[TD]Doe, John[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]17[/TD]
[TD="align: right"]25[/TD]
[TD="align: right"]13[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]23[/TD]
[/TR]
[TR]
[TD]Subtotal[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]57[/TD]
[TD="align: right"]75[/TD]
[TD="align: right"]45[/TD]
[TD="align: right"]35[/TD]
[TD="align: right"]34[/TD]
[/TR]
[TR]
[TD]Smith, Larry[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]32[/TD]
[TD="align: right"]45[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]22[/TD]
[TD="align: right"]14[/TD]
[/TR]
[TR]
[TD]Smith, Larry[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]11[/TD]
[TD="align: right"]14[/TD]
[TD="align: right"]22[/TD]
[TD="align: right"]11[/TD]
[TD="align: right"]7[/TD]
[/TR]
[TR]
[TD]Subtotal[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]43[/TD]
[TD="align: right"]59[/TD]
[TD="align: right"]37[/TD]
[TD="align: right"]33[/TD]
[TD="align: right"]21[/TD]
[/TR]
</tbody>[/TABLE]
I need to insert a row at the end of Doe, John and total the columns that have numbers. Actually, I need to insert a row at the end of every person and add the columns that have numbers. The following week, the spreadsheet will have an extra column "Week 6" and this will go on to infinity...theoretically. Can someone help me with the VBA to insert a subtotal row for each individual and to sum the columns where there are numbers. In my actual spreadsheet, Column "A" is the name and the numbers columns start at column "D" and go out from there.
Any help would be much appreciated.
Thanks,
Jay
For Example:
[TABLE="width: 527"]
<tbody>[TR]
[TD]Name[/TD]
[TD]XXX[/TD]
[TD]XXX[/TD]
[TD]Week 1[/TD]
[TD]Week 2[/TD]
[TD]Week 3[/TD]
[TD]Week 4[/TD]
[TD]Week 5[/TD]
[/TR]
[TR]
[TD]Doe, John[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]40[/TD]
[TD="align: right"]50[/TD]
[TD="align: right"]32[/TD]
[TD="align: right"]25[/TD]
[TD="align: right"]11[/TD]
[/TR]
[TR]
[TD]Doe, John[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]17[/TD]
[TD="align: right"]25[/TD]
[TD="align: right"]13[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]23[/TD]
[/TR]
[TR]
[TD]Smith, Larry[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]32[/TD]
[TD="align: right"]45[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]22[/TD]
[TD="align: right"]14[/TD]
[/TR]
[TR]
[TD]Smith, Larry[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]11[/TD]
[TD="align: right"]14[/TD]
[TD="align: right"]22[/TD]
[TD="align: right"]11[/TD]
[TD="align: right"]7[/TD]
[/TR]
</tbody>[/TABLE]
Final product would look like:
[TABLE="width: 527"]
<tbody>[TR]
[TD]Name[/TD]
[TD]XXX[/TD]
[TD]XXX[/TD]
[TD]Week 1[/TD]
[TD]Week 2[/TD]
[TD]Week 3[/TD]
[TD]Week 4[/TD]
[TD]Week 5[/TD]
[/TR]
[TR]
[TD]Doe, John[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]40[/TD]
[TD="align: right"]50[/TD]
[TD="align: right"]32[/TD]
[TD="align: right"]25[/TD]
[TD="align: right"]11[/TD]
[/TR]
[TR]
[TD]Doe, John[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]17[/TD]
[TD="align: right"]25[/TD]
[TD="align: right"]13[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]23[/TD]
[/TR]
[TR]
[TD]Subtotal[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]57[/TD]
[TD="align: right"]75[/TD]
[TD="align: right"]45[/TD]
[TD="align: right"]35[/TD]
[TD="align: right"]34[/TD]
[/TR]
[TR]
[TD]Smith, Larry[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]32[/TD]
[TD="align: right"]45[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]22[/TD]
[TD="align: right"]14[/TD]
[/TR]
[TR]
[TD]Smith, Larry[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]11[/TD]
[TD="align: right"]14[/TD]
[TD="align: right"]22[/TD]
[TD="align: right"]11[/TD]
[TD="align: right"]7[/TD]
[/TR]
[TR]
[TD]Subtotal[/TD]
[TD][/TD]
[TD][/TD]
[TD="align: right"]43[/TD]
[TD="align: right"]59[/TD]
[TD="align: right"]37[/TD]
[TD="align: right"]33[/TD]
[TD="align: right"]21[/TD]
[/TR]
</tbody>[/TABLE]
I need to insert a row at the end of Doe, John and total the columns that have numbers. Actually, I need to insert a row at the end of every person and add the columns that have numbers. The following week, the spreadsheet will have an extra column "Week 6" and this will go on to infinity...theoretically. Can someone help me with the VBA to insert a subtotal row for each individual and to sum the columns where there are numbers. In my actual spreadsheet, Column "A" is the name and the numbers columns start at column "D" and go out from there.
Any help would be much appreciated.
Thanks,
Jay