

With Worksheets("Different Columns").Range("B4")
EXCEL MACROS EXAMPLES CODE
Apply VBA Code to Filter Data with Multiple Criteria in Different Columns in Excel Read More: Filter Multiple Criteria in Excel (4 Suitable Ways)ģ. Soon after, you will get the Filtered rows based on multiple criteria like the image below. Later, select the specified Macro name and press Run.At this moment, follow the third step from the first example to open the Macros dialog box.Finally, I used Operator:=xlOr to apply OR condition Filter for multiple criteria.Here, Criteria1:=”Graduate” and Criteria2:=”Postgraduate” to Filter the student’s Status. Next, I used the AutoFilter method to use the Criteria of my choice where Field:=3 means column 3.Here, I created a Sub procedure, Filter_One_Column().Worksheets("One Column").Range("B4").AutoFilter Field:=3, Criteria1:="Graduate", Operator:=xlOr, Criteria2:="Postgraduate" Follow the first two steps of the first example to open the VBA window.From column number three of the dataset, we’ll Filter for Graduate and Postgraduate students.

Here, we’ll Filter for multiple criteria in one column. Apply VBA Code to Filter Data with Multiple Criteria in One Column

Read More: Excel Filter Data Based on Cell Value (6 Efficient Ways)Ģ. Now have a look that we have got only Male students’ data after Filtering. Select the Macro name as mentioned in the codes.After that, to open the Macros dialog box, click as follows: Developer > Macros.And Criteria1:=”Male” to Filter the data for Male. Next, I used the AutoFilter method to use Criteria of my choice where Field:=2 means column 2.Then used the Range property to declare our respective sheet name and range.Here, I created a Sub procedure, Filter_Data_Text().
