macro button to filter out list

phoj69

New Member
Joined
Sep 22, 2014
Messages
4
I have a report that has thousands of lines and each part # on that line has a specific stocking location. Now there are certain locations that I want to see and certain ones that I want to filter out. Is there a macro that I can set up so I set up a button and it filters out from the list? So if a had seperate lines that had locations a, b, c, d, e, f, g, h and I had another file that had locations g and h on it, it would filter out those. But this would be thosuands of lines so I need a way to look at that entire list
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

ChrisBM

Board Regular
Joined
Sep 22, 2014
Messages
215
You are potentially better off just filtering the data? That way you can quickly and easily get to the data you are interested in.

Just apply a filter to the header row and select 'g and h' in the locations filter.

----------------------------------
If you want a macro to do it you can do it with using a For loop to loop through each row, check value in locations column and see whether it exists in the ones you are looking for, then hiding the row. Let me know if you need help with this.

Kind Regards,
Chris
 

phoj69

New Member
Joined
Sep 22, 2014
Messages
4
The problem I have is the # of locations I need to filter out is over 200 different locations. Someone from this board helped me set up a filter to get rid of those fields but I was hoping to set up a button that the person could just click and it would filter out all of those locations.


You are potentially better off just filtering the data? That way you can quickly and easily get to the data you are interested in.

Just apply a filter to the header row and select 'g and h' in the locations filter.

----------------------------------
If you want a macro to do it you can do it with using a For loop to loop through each row, check value in locations column and see whether it exists in the ones you are looking for, then hiding the row. Let me know if you need help with this.

Kind Regards,
Chris
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,016
Messages
5,834,948
Members
430,330
Latest member
drAli77

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
Top