Daruki
Daruki

Reputation: 491

Autofilter with more than 3 criteria

I am using the following code to autofilter a column using more than 3 criteria - however, it is saying the "Autofilter method of range class failed"

This code looked to be working on another SO post.

Can anyone assist?

Thanks

Public Sub autofilter2()
Dim ws As Worksheet
Dim wsOut As Worksheet
Dim a As String

Dim b As String
Dim c As String

Set ws = Worksheets("Raw Data")
'AutoFilterMode = False
a = Cells(69, 6).Value
b = Cells(69, 7).Value
c = Cells(69, 8).Value


ws.Range("A:bk").autofilter field:=64, _
Criteria1:=Array(a, b, c), _
Operator:=xlFilterValues



End Sub

Upvotes: 0

Views: 293

Answers (1)

Gary's Student
Gary's Student

Reputation: 96791

64 is beyond column BK. The max you can have is 63

Upvotes: 2

Related Questions