I've been using a line like:
Cells.AutoFilter 11, "0"
for a while to autofilter column 11 for "0".
I recently updated to Microsoft Office 2013 and now I'm getting an AutoFilter method of Range class failed
runtime error with this line. Is this a compatibility issue with Office 2013 or some other problem?
EDIT: I should clarify that I am not getting an error with a program I already run, but rather a line which I've used before and is not working for me right now.
Code:
Dim firstRow As Integer
Dim lastRow As Integer
Dim firstCol As Integer
Dim lastCol As Integer
Dim allRange As Range
Dim vRange As Range
Dim bRange As Range
Dim commentsCol As Integer
Dim commentsColRng As Range
Dim fieldNameCol As Integer
Dim userCol As Integer
If Cells(2, 1) <> "" Then
firstCol = 1
lastCol = Cells(1, Columns.Count).End(xlToLeft).Column
firstRow = 2
lastRow = Cells(Rows.Count, "A").End(xlUp).Row
commentsCol = Rows(1).find("Comments").Column '11
fieldNameCol = Rows(1).find("Field Name").Column '8
userCol = Rows(1).find("User").Column '4
Set allRange = Range(Cells(firstRow, firstCol), Cells(lastRow, lastCol))
Set commentsColRng = Range(Cells(firstRow, commentsCol), Cells(lastRow, commentsCol))
Cells.AutoFilter Field:=1, Criteria1:="PF"
Cells.AutoFilter commentsCol, "0", xlFilterValues
Cells.AutoFilter Field:=2, Criteria1:="0", Operator:=xlFilterValues
End If
I have three autofilters because I'm trying it multiple different ways.
You might not have anything in column 11.
For example: