WoeIs
WoeIs

Reputation: 1083

Is there a way that I can auto filter a table in VBA based on a cell value?

I have a cell V2 which has a number. I want to filter a column in my table so that the values in that column are equal or greater to that value. So if cell V2 contains 5, then the rows in the specific column will all have value 5 or greater.

My current VBA code only seems to filter for exact values, not greater than values. I've tried adding ">=" under the criteria in different places but each time, the syntax is wrong.

Worksheets("Scores").ListObjects("MyDatabase").Range.AutoFilter Field:=19, Criteria1:= _
Worksheets("Scores").Range("V2").Value

Upvotes: 0

Views: 62

Answers (1)

Josh Eller
Josh Eller

Reputation: 2065

You can use:

Worksheets("Scores").ListObjects("MyDatabase").Range.AutoFilter Field:=19, Criteria1:= _
">=" & Worksheets("Scores").Range("V2").Value

Upvotes: 1

Related Questions