VBA If Statement to Filter out "0" zero value

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
2,347
Office Version
  1. 365
Platform
  1. Windows
I have code that will filter to a specific value but I need to filter out "0" from the identified table column (I dont want to show the rows that have 0 value)


Code that filters to a specific value

Code:
Sub FilterRanges()

If Range("D9").Value = Range("O15").Value Then

 With ActiveSheet.ListObjects("ProPricer_Quote_Data_Merged")
    .Range.AutoFilter Field:=.ListColumns("50q74").Index, Criteria1:=Range("C8").Value
  End With
End

Else

End If


End Sub

I tried recording a macro but I got a message saying there was too many values and the macro stoped

Any help is appreciated.
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Can you show us a small sample of your data?
What column is the "zero" filter to be applied to?
 
Upvote 0
Joe

Here is what I came up with that seems to work

If Range("D9").Value = Range("K15").Value Then

With ActiveSheet.ListObjects("ProPricer_Quote_Data_Merged")
.Range.AutoFilter Field:=.ListColumns("1q4").Index, Criteria1:="<>0", Operator:=xlFilterValues
End With
Else
 
Upvote 0
Solution

Forum statistics

Threads
1,224,517
Messages
6,179,240
Members
452,898
Latest member
Capolavoro009

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top