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

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
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?
 
Upvote 0

Forum statistics

Threads
1,219,161
Messages
6,146,657
Members
450,706
Latest member
LGVBPP

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