ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Filter With VB Code (https://www.excelbanter.com/excel-programming/336917-filter-vbulletin-code.html)

Cam

Filter With VB Code
 
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.





Tom Ogilvy

Filter With VB Code
 
Selection.AutoFilter Field:=4, Criteria1:="" & Range("L8").Value,
Operator:=xlAnd

--
Regards,
Tom Ogilvy




All times are GMT +1. The time now is 11:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com