Code for Sub-Total command with rows changing in Macro

danuguri

New Member
Joined
Dec 18, 2013
Messages
1
Dear Sir,

I am trying to have a code (to be written for macro) for performing Sub-Totals in the column I excel sheet as a part of automation. The rows will be dynamic and No. of rows for each sub-total changes every time. The sub-total shall be based on certain criteria which will be in other columns. Manually we are filtering for blanks on B column and E column and inserting sub-total formula in I column for sum operation. The total no. of rows may be upto 5000 Lines or more and may be even as less as 100 rows. No. of sub-totals may also vary depending on the rows. Once the macro is run, it shall all perform all the sub-totals based on above explained criteria.

Can any one help.

Pls. see below small example.

[TABLE="width: 935"]
<TBODY>[TR]
[TD] [/TD]
[TD]Slno.[/TD]
[TD]SubItem[/TD]
[TD] Description [/TD]
[TD]UOM[/TD]
[TD]Gross Qty [/TD]
[TD]Changes in Prices[/TD]
[TD]Final[/TD]
[TD] Amount [/TD]
[/TR]
[TR]
[TD]BU111811947502HV00000[/TD]
[TD]Main Item:BU111811947502HV00000 INSULATION ON HV COIL [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD][/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]BU111811947502HV00000[/TD]
[TD] [/TD]
[TD]107140400100[/TD]
[TD]P.B. GRADE-KPC:1x2000x3000mm [/TD]
[TD]kg [/TD]
[TD="align: right"]10.6337[/TD]
[TD="align: right"]185.00[/TD]
[TD="align: right"]185[/TD]
[TD="align: right"]1967.23[/TD]
[/TR]
[TR]
[TD]BU111811947502HV00000[/TD]
[TD] [/TD]
[TD]107140000150[/TD]
[TD]P.B. 1.50 mm GRADE-KPC (IB-56 [/TD]
[TD]kg [/TD]
[TD="align: right"]24.2[/TD]
[TD="align: right"]116.70[/TD]
[TD="align: right"]116.7[/TD]
[TD="align: right"]2824.14[/TD]
[/TR]
[TR]
[TD]BU111811947502HV00000[/TD]
[TD] [/TD]
[TD]107140400200[/TD]
[TD]P.B. GRADE-KPC:2x2000x3000mm [/TD]
[TD]kg [/TD]
[TD="align: right"]6.6[/TD]
[TD="align: right"]185.00[/TD]
[TD="align: right"]185[/TD]
[TD="align: right"]1221.00[/TD]
[/TR]
[TR]
[TD]BU111811947502HV00000[/TD]
[TD] [/TD]
[TD]107140000300[/TD]
[TD]P.B. 3.00 mm GRADE-KPC (IB-56 [/TD]
[TD]kg [/TD]
[TD="align: right"]9.9[/TD]
[TD="align: right"]116.70[/TD]
[TD="align: right"]116.7[/TD]
[TD="align: right"]1155.33[/TD]
[/TR]
[TR]
[TD]BU111811947502HV00000[/TD]
[TD] [/TD]
[TD]107140000400[/TD]
[TD]P.B. 4.00 mm GRADE-KPC (IB-56 [/TD]
[TD]kg [/TD]
[TD="align: right"]2.9334[/TD]
[TD="align: right"]122.84[/TD]
[TD="align: right"]122.84[/TD]
[TD="align: right"]360.34[/TD]
[/TR]
[TR]
[TD]BU111811947502HV00000[/TD]
[TD] [/TD]
[TD]107140000500[/TD]
[TD]P.B. 5.00 mm GRADE-KPC (IB-56 [/TD]
[TD]kg [/TD]
[TD="align: right"]2.5663[/TD]
[TD="align: right"]122.84[/TD]
[TD="align: right"]122.84[/TD]
[TD="align: right"]315.24[/TD]
[/TR]
[TR]
[TD]BU111811947502HV00000[/TD]
[TD] [/TD]
[TD]107140000600[/TD]
[TD]P.B. 6.00 mm GRADE-KPC(IB-56) [/TD]
[TD]kg [/TD]
[TD="align: right"]5.5[/TD]
[TD="align: right"]122.84[/TD]
[TD="align: right"]122.84[/TD]
[TD="align: right"]675.62[/TD]
[/TR]
[TR]
[TD]BU111811947502HV00000[/TD]
[TD] [/TD]
[TD]107100000080[/TD]
[TD]P.B 0.80 mm GRADE-3 [/TD]
[TD]kg [/TD]
[TD="align: right"]0.7337[/TD]
[TD="align: right"]220.42[/TD]
[TD="align: right"]220.42[/TD]
[TD="align: right"]161.72[/TD]
[/TR]
[TR]
[TD]BU111811947502HV00000[/TD]
[TD] [/TD]
[TD]BU1118119207140400150[/TD]
[TD]P.B.GRADE-KPC:1.5X2000X3000mm [/TD]
[TD]kg [/TD]
[TD="align: right"]1.65[/TD]
[TD="align: right"]116.70[/TD]
[TD="align: right"]116.7[/TD]
[TD="align: right"]192.56[/TD]
[/TR]
[TR]
[TD]BU111811947502HV00000[/TD]
[TD] [/TD]
[TD]107140400300[/TD]
[TD]P.B. GRADE-KPC:3x2000x3000mm [/TD]
[TD]kg [/TD]
[TD="align: right"]22[/TD]
[TD="align: right"]185.00[/TD]
[TD="align: right"]185[/TD]
[TD="align: right"]4070.00[/TD]
[/TR]
[TR]
[TD]BU111811947502HV00000[/TD]
[TD] [/TD]
[TD]BU1118119207020100001[/TD]
[TD]HV IND RING : 709/581 , 35thk[/TD]
[TD]nos[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]2323.83[/TD]
[TD="align: right"]2323.8329[/TD]
[TD="align: right"]2323.83[/TD]
[/TR]
[TR]
[TD]BU111811947502HV00000[/TD]
[TD] [/TD]
[TD]BU1118119207020100002[/TD]
[TD]HV IND.RING 2:709/581;35THK [/TD]
[TD]Nos[/TD]
[TD="align: right"]1[/TD]
[TD="align: right"]2323.83[/TD]
[TD="align: right"]2323.8329[/TD]
[TD="align: right"]2323.83[/TD]
[/TR]
[TR]
[TD]BU111811947502HV00000[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD][/TD]
[TD="align: right"]17590.85[/TD]
[/TR]
[TR]
[TD]BU111811947504CA00000[/TD]
[TD]Main Item:BU111811947504CA00000 INSULATION AT CORE ASSEMBLY [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD][/TD]
[TD] [/TD]
[/TR]
[TR]
[TD]BU111811947504CA00000[/TD]
[TD] [/TD]
[TD]107140000400[/TD]
[TD]P.B. 4.00 mm GRADE-KPC (IB-56 [/TD]
[TD]kg [/TD]
[TD="align: right"]15.18[/TD]
[TD="align: right"]122.84[/TD]
[TD="align: right"]122.84[/TD]
[TD="align: right"]1864.71[/TD]
[/TR]
[TR]
[TD]BU111811947504CA00000


Thanks in advance.

Regards

D Sampath Kumar[/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD] [/TD]
[TD][/TD]
[TD="align: right"]1864.71[/TD]
[/TR]
</TBODY><COLGROUP><COL><COL><COL><COL><COL span=2><COL><COL><COL></COLGROUP>[/TABLE]
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Forum statistics

Threads
1,223,248
Messages
6,171,011
Members
452,374
Latest member
keccles

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