ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   What is the syntax for using the "IF" condition with an autofilte. (https://www.excelbanter.com/excel-discussion-misc-queries/90953-what-syntax-using-if-condition-autofilte.html)

peter147

What is the syntax for using the "IF" condition with an autofilte.
 
I want to write a macro that applies .AutoFilter to a range,
I have got this far
" Selection.AutoFilter Field:=1, Criteria1:="#REF!", Operator:=xlAnd"

BUT what is the syntax when "#REF!" does not apear in the filtered list so I
can return the list to the original condition and not make any changes?
Thank you
Peter147

Peo Sjoblom

What is the syntax for using the "IF" condition with an autofilte.
 
There is no such criteria, you filter using a criteria, I expect you would
have your macro to check if there are no ref errors before you apply the
filter criteria. Maybe you could explain what you are trying to do in the
first place and maybe someone here can answer that?

--

Regards,

Peo Sjoblom

Excel 95 - Excel 2007
Northwest Excel Solutions
www.nwexcelsolutions.com
"It is a good thing to follow the first law of holes;
if you are in one stop digging." Lord Healey


"peter147" wrote in message
...
I want to write a macro that applies .AutoFilter to a range,
I have got this far
" Selection.AutoFilter Field:=1, Criteria1:="#REF!", Operator:=xlAnd"

BUT what is the syntax when "#REF!" does not apear in the filtered list so
I
can return the list to the original condition and not make any changes?
Thank you
Peter147





All times are GMT +1. The time now is 02:30 PM.

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