How to maintain a Filter without resetting when Grouping and Ungrouping rows

Grimm127

Board Regular
Joined
Aug 17, 2011
Messages
132
Hi All,

I am running a filter with a bunch of groups for my PnL.
The challenge is that I have a column that lets me know that a particular row has no values and to reflect "H" (Hide) or "K" (Keep). So when I use the filter it hides the empty rows for that particular PnL. Its a template so these fields will change as I switch to different accounts.

The problem is that I also have groups in the PnL. So as I open and close the groupings the filter is override so it is showing everything again.

Is there a VBA code I can use that when ever I open or close a group it automatically reapplies the filter?

Thank you for your time in advance.......
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Hi,

for all of you who encounter this problem nowadays...
Grouping / Filtering / Hiding Columns and Rows are using the the same core function in Excel.
So if you collapse a group, then Excel basically is hiding the grouped rows.

-> so maintaining the filtering does not work.


My solution was to
  • remove the excel grouping
  • add a column with "x" which shows which row should be displayed
  • create a "+"button at each later group headline
  • make a short VBA makro to hide / show everything which does not have an "x"

Its actually just as fast as the Excel grouping.
Sadly its really the only way, I could imagine.

maybe also look at this
Grouping and ungrouping rows in excel using VBA assigning x1 button for opening and closing
 
Upvote 0

Forum statistics

Threads
1,214,940
Messages
6,122,356
Members
449,080
Latest member
Armadillos

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