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