Excel Selection as Filter Criteria | VBA Macro #79

Macro Intro

Filtering through large sets of data can be a challenge especially if you are looking to only apply a subset of filter selections through 100s of selections options. Good news is there is a better way with VBA when using the Leverage & Lean Excel Selection as Filter Criteria macro! This Excel macro will reference your current selection and use the contents of this range as the filter criteria. The Excel Selection as Filter Criteria macro is designed to reference the first row of Excel as the Headers. This is important when you make your selection to ensure that the first row of the column contains the header that you want to filter. When the Excel Selection as Filter Criteria macro is run it will loop through all the columns in the first row and filter the column that contains the same header as your current selection. Because this Excel macro will display only the necessary rows it can be difficult to recall the selection that was made which is why this macro finishes with a message box displaying the current selection used for the filter criteria. If you want to filter across multiple columns, then take a moment to check out the Insider version of the Excel Selection as Filter Criteria macro!

See it in Action

Watch this video to see this macro in action.

Code

Here is the code for this macro. Make sure the following References are setup before running it: Visual Basic For Applications, Microsoft Excel 16.0 Object Library

Insider Content

Here is the Insider code for this macro. The Insider version of the Excel Selection as Filter Criteria macro will allow you to set the Filter Criteria for multiple columns not just one like the Free version. Simply ensure that the selections that you make have a column header matching the column(s) you want to filter. Make sure the following References are setup before running it: Visual Basic For Applications, Microsoft Excel 16.0 Object Library

Search

First time using VBA?

The Developer Tab is an additional section of the ribbon when activated allows you access to Visual Basic in Applications like Access, Excel, Outlook, PowerPoint, Word.
Setup Now
Once the Developer Tab is available you will have the capability to update your security to allow Macros to run in the current application.
Setup Now
A sub of code is a collection of objects and variables. For the code to successfully run a library of references needs to be set.
Setup Now
Subscribe as an Insider to receive additional rights.
If you like our content and want to show your support tip us here!

Contact Us

Looking to improve your computer processes?
Leverage & Lean is here to help!

Powered By MemberPress WooCommerce Plus Integration

Free Macro

Start creating Less Clicks, More Results today!