Hi,
I am trying to write a macro which applies an auto filter to a table, but to apply the filter based on a selection of true / false criteria. This is what I have so far..when I run, it doesn't work with the if statement but the second line does work on its own. Any ideas what I'm doing wrong.
(apologies I'm not sure how to box off the code for this post)
Sub FIlterCriteria()
With ActiveWorkbook
If Sheet12.Range("C6").Value = "TRUE" Then _
Sheet2.Range("A1:AI1").AutoFilter Field:=1, Criteria1:= "Y"
If Sheet12.Range("C7").Value = "FALSE" Then _
Sheet2.Range("A1:AI1").AutoFilter Field:=12, Criteria1:="="
End if
end sub
'this macro is looking at my workbook, sheet12, cell C6 and if the value is True, it's going to sheet2 with my table and filtering out the Y from the 1st column. The go back to sheet12, look in cell C7 and if it's value is FALSE then going back to sheet12 to my table and filtering out the blanks from the 12th column. If I run the 2 AutoFilter rows of code on their own they work, but don't seem to with the if statements in.
Any help appreciated
Ross
Bookmarks