Overview

If you’ve ever worked with an Excel file filled with similar worksheets, you probably know how annoying it is that some Excel features don’t play well with multiple sheets, such as filtering.  These can be especially frustrating for businesses in retail, restaurant, and other multi-unit industries, or anyone that reviews results across several similarly-structured worksheets.

Thankfully, VBA provides us with several approaches that can automate this common task.  In this article, we’ll explore three different approaches you can use to apply filters to multiple worksheets at one time.  All three approaches share the huge benefit of saving a lot of time in automating what is often a very time-consuming manual task.

Approach 1 – Specify Filter Criteria in VBA Code

The obvious approach is to specify the sheets, ranges, columns, and filter criteria directly in the VBA code.  The sheets can be individual sheets, all sheets in the file, or all selected sheets.  In the example code screenshot below, all selected sheets are used to apply certain filter criteria in the first macro, and remove all the filters in the second macro.

Pros: 

It’s simple to write, and you can make it much more specific if you want to tailor to the needs of your file.

Cons:

It’s not very scalable, and requires modifying the VBA code for different use cases.

Approach 2 – Specify Filter Criteria in a Settings Sheet

A much more flexible approach is to list the sheets, ranges, columns, and filter criteria in a sheet that users can manage and not have to touch the VBA code.  These settings can be saved and used over and over again within a template.  In the screenshot below, the range, sheet, column, and filter criteria have been listed in a settings sheet, which can be leveraged by a macro to apply in one bulk step.

Pros:

It’s very flexible, scalable, and reusable, and allows you to easily specify different filter settings across different sheets without touching the code.

Cons:

Depending on the specific logic you want to build in to your settings, it may take some effort to set up the sheets, ranges, columns, and filter criteria the first time.

Learn more about this approach with the Bulk Filter macro, one of hundreds of macros available in the XLEV8 Excel Add-in.

Approach 3 – Copy Filter Criteria to Other Sheets

Another great approach is to mirror the same filter criteria across multiple sheets with the same header columns.  This works very well when you have reports that are exported across several sheets – by location, by cost center, by person, by company, etc.  In the screenshot below, a macro is prompting the user whether to copy the filter criteria to all selected sheets..

Pros:

It’s the easiest way to replicate the same filter criteria across several sheets that are very similar in structure.

Cons:

All the selected sheets need to have the same column headings and filter criteria to be applied.

Learn more about this approach with the Filter All Sheets macro, one of hundreds of macros available in the XLEV8 Excel Add-in.

Summary

If you work with filters across a lot of sheets in Excel, it’s worth knowing about some approaches to use them efficiently.  This allows you to spend more time doing valuable analysis – finding errors and opportunities for improvement.  The next time you feel hampered by filters, remember these approaches!

What tricks do you have for using filters in Excel?  Let us know in the comments below!

Don't miss great tips, tricks, news, and events!

  • Get our 105 Excel Tips e-book free!
  • Get monthly insights and news
  • Valuable time-saving best practices
  • Unlock exclusive resources

Almost there! We just need to confirm the email address is yours. Please check your email for a confirmation message.