Macro Intro
This is an Excel macro that will filter a column and create a new worksheet for each unique value found. By default, the active column selected will be filtered. If the active column selected is blank an InputBox will ask for the column number to filter. (Example: A=1, B=2, C=3, etc.) Once a column has been identified the duplicate values will be removed and what remains will be used to determine how many worksheets to create. The Excel Create Worksheet per Filter Value macro will then pull in the relevant information into each worksheet. This macro is an efficient way to view your data in separate worksheets. You could filter and checkmark one option at a time but this is labor some, especially if you want to analyze each value independently. It takes even more time to copy and paste information into its own worksheet. Using VBA, you can eliminate the manual work and complete all these actions at once!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, OLE Automation, Microsoft Office 16.0 Object LibraryCustomization
These segments of code can be customized to personalize this macro.If the filtered column returns more than 50 values the macro will exit to ensure the Excel can handle the request. Update this number to reflect how you want this to behave.
If you are not working with a header row then you should change Counter = 1
If you don’t want the filter to be removed from the first spreadsheet make this line a comment with ‘
If you don’t want the duplicates column to be deleted from the first spreadsheet make this line a comment with ‘
If you don’t want this macro to finish with a MsgBox then make this line a comment with ‘