Filter With VB Code

G

Guest

Hi,

I am attempting to filter a set of data based upon the values in other cells
within the worksheet. I have no VB knowledge so I have recorded a macro and
ammended its VB code :

Columns("A:H").Select
Selection.AutoFilter
Selection.AutoFilter Field:=4, Criteria1:=Range("L8"), Operator:=xlAnd
Selection.AutoFilter Field:=6, Criteria1:=Range("M8"), Operator:=xlAnd

How do I make the 3rd line look for a value above cell the value within cell
"L8" it works fine when looking for values that equal it, but wherever I put
the greater than sign an error message is generated.

Thanks,
Cam.
 
T

Tom Ogilvy

Selection.AutoFilter Field:=4, Criteria1:=">" & Range("L8").Value,
Operator:=xlAnd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top