Filter By Cell Value via VBA

seguin85

Active Member
Joined
Mar 17, 2015
Messages
278
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I have a master table that I want to sort by 3 different ranges based on another sheet within the same workbook. These 3 ranges are located in range A3:A20, C3:C20, and E3:E20 on a sheet titleed Filer_Lists.

I want Button1 to filter by range A3:A20, Button2 by C3:C20 and Button3 to filter by E3:E20.

The problem I am running into is when there is a value in the range that is not in the master table.

This is what presently have:

Code:
With ActiveSheet

    .Range("$A$9:$AIM$1281").AutoFilter Field:=4, Criteria1:=Worksheets("Filter_Lists").Range("A3").Value, Operator:=xlOr, _
                                                  Criteria2:=Worksheets("Filter_Lists").Range("A4").Value, Operator:=xlOr, _
                                                  Criteria3:=Worksheets("Filter_Lists").Range("A5").Value, Operator:=xlOr,
                                                  etc
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Or try:

Code:
With ActiveSheet

    .Range("A9:AIM1281").AutoFilter Field:=4, _
        Criteria1:=Application.Transpose(Sheets("Filer_Lists").Range("A3:A20").Value), _
        Operator:=xlFilterValues

By the way, you have almost 1,000 columns in the range ?
 
Last edited:
Upvote 0
Thanks I will try that, and yes, they are date columns (one column per day) out until February 2019. It is a list to schedule people per day, and a way to track if we plan to be slow or need to hire people.
 
Upvote 0

Forum statistics

Threads
1,214,905
Messages
6,122,172
Members
449,071
Latest member
cdnMech

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
Back
Top