Macro to fill tables that have changing number of rows

haganator

New Member
Joined
Aug 5, 2008
Messages
42
Greetings everyone,

I'm trying to write a macro that will read data from one spreadsheet and graph it in another when the number of rows is variable. The data consists of 8 tables. Each table will have a maximum of 24 rows. The number of columns are different for each table, but they don't change. I have a macro that will populate my tables correctly when there is a full days' worth of data (24 rows)...I can hard code the size of each table. What I'm trying to do is write a macro that will populate my tables if there's only a partial days' worth of data. Each table has a title and a header. The header could be 2-4 rows. I initially thought of searching for the table title and then using an offset command to get to the first row, but I couldn't figure out how to make that work. Any ideas would be greatly appreciated. Below is a clip of 2 of the tables, currently showing 14 hours of data.

Many thanks in advance,
Jeff

[TABLE="width: 1080"]
<colgroup><col span="15"></colgroup><tbody>[TR]
[TD="colspan: 3"]PCSS0-Session-Stats[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD]RPP0[/TD]
[TD]RPP1[/TD]
[TD]RPP4[/TD]
[TD]RPP5[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Hour[/TD]
[TD]A[/TD]
[TD]D[/TD]
[TD]A[/TD]
[TD]D[/TD]
[TD]A[/TD]
[TD]D[/TD]
[TD]A[/TD]
[TD]D[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]0[/TD]
[TD="align: right"]397[/TD]
[TD="align: right"]9204[/TD]
[TD="align: right"]401[/TD]
[TD="align: right"]9292[/TD]
[TD="align: right"]392[/TD]
[TD="align: right"]9009[/TD]
[TD="align: right"]389[/TD]
[TD="align: right"]9324[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD="align: right"]351[/TD]
[TD="align: right"]8559[/TD]
[TD="align: right"]330[/TD]
[TD="align: right"]8610[/TD]
[TD="align: right"]329[/TD]
[TD="align: right"]8425[/TD]
[TD="align: right"]328[/TD]
[TD="align: right"]8685[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD="align: right"]331[/TD]
[TD="align: right"]8153[/TD]
[TD="align: right"]317[/TD]
[TD="align: right"]8147[/TD]
[TD="align: right"]314[/TD]
[TD="align: right"]7985[/TD]
[TD="align: right"]310[/TD]
[TD="align: right"]8290[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD="align: right"]319[/TD]
[TD="align: right"]7901[/TD]
[TD="align: right"]299[/TD]
[TD="align: right"]7924[/TD]
[TD="align: right"]331[/TD]
[TD="align: right"]7857[/TD]
[TD="align: right"]318[/TD]
[TD="align: right"]7966[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]4[/TD]
[TD="align: right"]351[/TD]
[TD="align: right"]7880[/TD]
[TD="align: right"]333[/TD]
[TD="align: right"]7928[/TD]
[TD="align: right"]329[/TD]
[TD="align: right"]7714[/TD]
[TD="align: right"]320[/TD]
[TD="align: right"]7906[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]5[/TD]
[TD="align: right"]375[/TD]
[TD="align: right"]8379[/TD]
[TD="align: right"]408[/TD]
[TD="align: right"]8481[/TD]
[TD="align: right"]395[/TD]
[TD="align: right"]8298[/TD]
[TD="align: right"]385[/TD]
[TD="align: right"]8565[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]6[/TD]
[TD="align: right"]467[/TD]
[TD="align: right"]9250[/TD]
[TD="align: right"]462[/TD]
[TD="align: right"]9494[/TD]
[TD="align: right"]476[/TD]
[TD="align: right"]9218[/TD]
[TD="align: right"]469[/TD]
[TD="align: right"]9576[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]7[/TD]
[TD="align: right"]592[/TD]
[TD="align: right"]10405[/TD]
[TD="align: right"]602[/TD]
[TD="align: right"]10489[/TD]
[TD="align: right"]613[/TD]
[TD="align: right"]10180[/TD]
[TD="align: right"]579[/TD]
[TD="align: right"]10688[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]8[/TD]
[TD="align: right"]689[/TD]
[TD="align: right"]11212[/TD]
[TD="align: right"]672[/TD]
[TD="align: right"]11447[/TD]
[TD="align: right"]680[/TD]
[TD="align: right"]10894[/TD]
[TD="align: right"]677[/TD]
[TD="align: right"]11203[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]9[/TD]
[TD="align: right"]738[/TD]
[TD="align: right"]11427[/TD]
[TD="align: right"]728[/TD]
[TD="align: right"]11779[/TD]
[TD="align: right"]723[/TD]
[TD="align: right"]11127[/TD]
[TD="align: right"]739[/TD]
[TD="align: right"]11633[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]10[/TD]
[TD="align: right"]749[/TD]
[TD="align: right"]11453[/TD]
[TD="align: right"]747[/TD]
[TD="align: right"]11984[/TD]
[TD="align: right"]765[/TD]
[TD="align: right"]11456[/TD]
[TD="align: right"]749[/TD]
[TD="align: right"]11833[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]11[/TD]
[TD="align: right"]744[/TD]
[TD="align: right"]11749[/TD]
[TD="align: right"]752[/TD]
[TD="align: right"]12194[/TD]
[TD="align: right"]720[/TD]
[TD="align: right"]11530[/TD]
[TD="align: right"]793[/TD]
[TD="align: right"]12154[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]12[/TD]
[TD="align: right"]754[/TD]
[TD="align: right"]11969[/TD]
[TD="align: right"]749[/TD]
[TD="align: right"]12222[/TD]
[TD="align: right"]695[/TD]
[TD="align: right"]11732[/TD]
[TD="align: right"]728[/TD]
[TD="align: right"]12387[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]13[/TD]
[TD="align: right"]756[/TD]
[TD="align: right"]11908[/TD]
[TD="align: right"]774[/TD]
[TD="align: right"]12205[/TD]
[TD="align: right"]759[/TD]
[TD="align: right"]11856[/TD]
[TD="align: right"]734[/TD]
[TD="align: right"]12569[/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]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 2"]PCSS0-CPU-Stats[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Hour[/TD]
[TD]PMP[/TD]
[TD]RPP0[/TD]
[TD]RPP1[/TD]
[TD]RPP4[/TD]
[TD]RPP5[/TD]
[TD]PEP0[/TD]
[TD]PEP1[/TD]
[TD]PMP[/TD]
[TD]RPP0[/TD]
[TD]RPP1[/TD]
[TD]RPP4[/TD]
[TD]RPP5[/TD]
[TD]PEP0[/TD]
[TD]PEP1[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]PK[/TD]
[TD]PK[/TD]
[TD]PK[/TD]
[TD]PK[/TD]
[TD]PK[/TD]
[TD]PK[/TD]
[TD]PK[/TD]
[TD]AV[/TD]
[TD]AV[/TD]
[TD]AV[/TD]
[TD]AV[/TD]
[TD]AV[/TD]
[TD]AV[/TD]
[TD]AV[/TD]
[/TR]
[TR]
[TD="align: right"]0[/TD]
[TD="align: right"]17[/TD]
[TD="align: right"]9[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD="align: right"]1[/TD]
[TD="align: right"]17[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[TD="align: right"]16[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD="align: right"]3[/TD]
[TD="align: right"]16[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD="align: right"]4[/TD]
[TD="align: right"]17[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD="align: right"]5[/TD]
[TD="align: right"]16[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]5[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]6[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD="align: right"]6[/TD]
[TD="align: right"]17[/TD]
[TD="align: right"]9[/TD]
[TD="align: right"]9[/TD]
[TD="align: right"]9[/TD]
[TD="align: right"]9[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]7[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD="align: right"]7[/TD]
[TD="align: right"]17[/TD]
[TD="align: right"]12[/TD]
[TD="align: right"]12[/TD]
[TD="align: right"]11[/TD]
[TD="align: right"]12[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]9[/TD]
[TD="align: right"]9[/TD]
[TD="align: right"]9[/TD]
[TD="align: right"]9[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD="align: right"]8[/TD]
[TD="align: right"]18[/TD]
[TD="align: right"]14[/TD]
[TD="align: right"]14[/TD]
[TD="align: right"]13[/TD]
[TD="align: right"]13[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]8[/TD]
[TD="align: right"]11[/TD]
[TD="align: right"]11[/TD]
[TD="align: right"]10[/TD]
[TD="align: right"]11[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD="align: right"]9[/TD]
[TD="align: right"]18[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]14[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]9[/TD]
[TD="align: right"]12[/TD]
[TD="align: right"]12[/TD]
[TD="align: right"]12[/TD]
[TD="align: right"]12[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD="align: right"]10[/TD]
[TD="align: right"]17[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]9[/TD]
[TD="align: right"]12[/TD]
[TD="align: right"]13[/TD]
[TD="align: right"]12[/TD]
[TD="align: right"]13[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD="align: right"]11[/TD]
[TD="align: right"]18[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]14[/TD]
[TD="align: right"]16[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]9[/TD]
[TD="align: right"]12[/TD]
[TD="align: right"]13[/TD]
[TD="align: right"]12[/TD]
[TD="align: right"]13[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD="align: right"]12[/TD]
[TD="align: right"]18[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]14[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]9[/TD]
[TD="align: right"]13[/TD]
[TD="align: right"]13[/TD]
[TD="align: right"]12[/TD]
[TD="align: right"]13[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]3[/TD]
[/TR]
[TR]
[TD="align: right"]13[/TD]
[TD="align: right"]17[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]15[/TD]
[TD="align: right"]4[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]9[/TD]
[TD="align: right"]12[/TD]
[TD="align: right"]13[/TD]
[TD="align: right"]12[/TD]
[TD="align: right"]12[/TD]
[TD="align: right"]3[/TD]
[TD="align: right"]3[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top