# code for sum data after filter each time

#### sakijung

##### Board Regular
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

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the \$ sign).
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?

Replies
4
Views
326
Replies
11
Views
229
Replies
11
Views
265
Replies
1
Views
472
Replies
4
Views
268

1,217,332
Messages
6,135,945
Members
449,974
Latest member
riffburn

### 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.

### Which adblocker are you using?

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

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