troubleshooting Question

Excel Macro: Action when field doesn't equal specific text

Avatar of quaziblue
quaziblue asked on
Visual Basic ClassicMicrosoft Excel
3 Comments1 Solution865 ViewsLast Modified:
I have the following code which works for filtering all the cells where it doesn't equal zero.

With Sheets("Menu").Rows("10:10")
    .AutoFilter Field:=8, Criteria1:="<>0"
    .AutoFilter Field:=9, Criteria1:="<>0"
    .AutoFilter Field:=10, Criteria1:="=0.00"
End With

How can I change the following code to filter when the text inside the cell doesn't equal "Apple"?  If I add quotation marks around Apple, I get an error.  Any help would be appreciated.

With Sheets("Menu").Rows("10:10")
    .AutoFilter Field:=12, Criteria:="<>Apple"
End With
With Sheets("Menu").Rows("10:10")
    .AutoFilter Field:=8, Criteria1:="<>0"
    .AutoFilter Field:=9, Criteria1:="<>0"
    .AutoFilter Field:=10, Criteria1:="=0.00"
End With
 
With Sheets("Menu").Rows("10:10")
    .AutoFilter Field:=12, Criteria:="<>Apple"
End With
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros