rjplante
Well-known Member
- Joined
- Oct 31, 2008
- Messages
- 569
- Office Version
- 365
- Platform
- Windows
I have a larger spreadsheet and I have an autofilter that runs to filter for rows that have a value greater than 0. This works just fine.
I was recently tasked with adding to the autofilter so that it would also filter out blanks and cells that have =0. The formula I have is listed below and everything up to Criteria1 is what I have that worked. I need to have my filter work to do the following:
Filter for values greater than 0
Filter out blanks
Filter out cells that =0
When I run my code it fails with this error.
Run-time error 1004:
Application-defined or object-defined error
I do not understand why it is failing. Can anyone help me figure out what I need to do to accomplish all three of these filter criteria?
I was recently tasked with adding to the autofilter so that it would also filter out blanks and cells that have =0. The formula I have is listed below and everything up to Criteria1 is what I have that worked. I need to have my filter work to do the following:
Filter for values greater than 0
Filter out blanks
Filter out cells that =0
VBA Code:
Sheets("Pricing Sheet").Range("$B$6:$B" & LRow).AutoFilter Field:=1, Criteria1:=">0", Operator:=xlAnd, Criteria2:="<>", Operator:=xlAnd, Criteria3:="<>0"
When I run my code it fails with this error.
Run-time error 1004:
Application-defined or object-defined error
I do not understand why it is failing. Can anyone help me figure out what I need to do to accomplish all three of these filter criteria?