VBA filters using 3 or more criteria

tanyaleblanc

Board Regular
Joined
Mar 16, 2019
Messages
145
I'm trying to filter using 3 criteria but I'm getting an error, here is the code I tried.

With ActiveSheet
.AutoFilterMode = False
With Range("A2:I2")
.AutoFilter
.AutoFilter field:=4, Criteria1:="Text56", Operator:=xlAnd, Criteria2:="Text76", Operator:=xlAnd, Criteria3:="Text80"
End With
End With
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Try
Code:
With ActiveSheet
   .AutoFilterMode = False
   With .Range("A2:I2")
      .AutoFilter 4, Array("Text56", "Text76", "Text80"), xlFilterValues
   End With
End With
 
Upvote 0
Works perfect, thank you so much, the purpose of the filter was so that I could delete those lines, but my delete is not working,

Sub Adjust_Report()
Dim lastrow As Long
Dim lRow As Long
Dim Rng As Range
If AutoFilterMode = True And FilterMode = True Then ActiveSheet.ShowAllData
Dim fd As Office.FileDialog
If AutoFilterMode = True And FilterMode = True Then ActiveSheet.ShowAllData
lRow = ActiveSheet.Range("A500").End(xlUp).Row

If Range("f3:f" & lRow).SpecialCells(xlCellTypeVisible).Count > 1 Then
ActiveSheet.Range("a2:j" & lRow).Offset(1, 0).SpecialCells(xlCellTypeVisible).EntireRow.Delete
End If
 
Last edited:
Upvote 0
How about
Code:
Sub Adjust_Report()
With ActiveSheet
   .AutoFilterMode = False
   With .Range("A2:I2")
      .AutoFilter 4, Array("Text56", "Text76", "Text80"), xlFilterValues
   End With
   .AutoFilter.Range.Offset(1).EntireRow.Delete
   .AutoFilterMode = False
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,200
Members
453,022
Latest member
RobertV1609

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