PDA

View Full Version : vba excel auto filter total



kellie1
02-27-2019, 09:38 AM
The test file has a coded total line which needs to be visible when users autofilter on their name. Currently when the user chooses their name from the auto filter drop down the total row disappears because column 'O' is where the user is auto filtering on their name and the total row for column 'O' is blank. We don't want the user to have to select blank and their name, we want 'blank' in column 'O' to always be set to checked.

Leith Ross
02-27-2019, 08:13 PM
Hello kellie1,

Your workbook seems to be a little short on data. There is only one entry per name on "Sheet2" and where are the "Total" rows?

kellie1
02-28-2019, 06:10 AM
I added more data, the total row is in u-af row 12, it is highlighted in yellow. The total row will be in a different row each day due to amt of data but the columns will remain the same.

Thanks

Leith Ross
02-28-2019, 09:14 AM
Hello Kellie1,

Thanks for posting the extra data. It makes sense now. The problem is the sum row is considered part of the filtered data. The easiest fix is to leave a blank row between the last row of the data and the sum row. To always set the blank rows in column "O" to checked will require VBA code. Since th workbook is in formula format, is VBA an option for you?

kellie1
02-28-2019, 09:40 AM
I know enough VBA to be dangerous and with the help of google have been able to learn what I've needed.
I have attached a word doc of the current code for the file, hope that helps with this request.

Paul_Hossler
02-28-2019, 09:44 AM
I know enough VBA to be dangerous and with the help of google have been able to learn what I've needed.
I have attached a word doc of the current code for the file, hope that helps with this request.

A better way would be leave the code in the workbook and attach the XLSM file so that everything stays together

That way someone trying to help can make certain that the macro uses the data to solve the issue

But if it were me, I'd put the totals in row 1, and use SUBTOTAL() so I wouldn't need any macros

23822

Leith Ross
02-28-2019, 10:16 AM
Hello Kellie1,

Thanks for the Word file. That is a lot of code and most of it appears to recorded macros which makes reading the code much slower. Unfortunately, I have an appointment to go to and will be gone about hour. If you don't get an answer by then, I will jump back into the thread to help.

kellie1
02-28-2019, 10:32 AM
I have attached a more comprehensive workbook with the VBA in the workbook.
I did at one point move the total row to the top but when filtering on a sales district name it was still not visible.
Unfortunately I am just the person who gathers the data and executes the formatting. The user group is resistant to change
so therefore when new requests come up we try to incorporate the new request into what we already have with as little disruption to what the user
already knows. Over the years I have bee able to figure out and execute the change requests but this one has me stumped.

Thanks