code for sum data after filter each time

sakijung

Board Regular
Joined
Jan 12, 2004
Messages
75
Good morning. I have a problem with sum in autofilter on my report in excel. I have a report for my curriculum in school. I used the formula =subtotal(9,xxx) every time that I filtered. I must to change the formula about the range. For example 1st time is =subtotal(9,a2:a8), 2nd is (9,a9:a20) and the range of cell is up to the curriculum and they are not constant. I would like some code or macro for summing the data after we filtered them.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,210
sakijung said:
Good morning. I have a problem with sum in autofilter on my report in excel. I have a report for my curriculum in school. I used the formula =subtotal(9,xxx) every time that I filtered. I must to change the formula about the range. For example 1st time is =subtotal(9,a2:a8), 2nd is (9,a9:a20) and the range of cell is up to the curriculum and they are not constant. I would like some code or macro for summing the data after we filtered them.

Why is it A2:A8 then A9:A20?
 

Forum statistics

Threads
1,181,614
Messages
5,930,948
Members
436,767
Latest member
Langaws

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
Top