Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-17-2013, 01:06 PM
coxjamd coxjamd is offline AutoFilter Criteria3 Windows XP AutoFilter Criteria3 Office 2010 32bit
Novice
AutoFilter Criteria3
 
Join Date: Jan 2012
Posts: 6
coxjamd is on a distinguished road
Default AutoFilter Criteria3

I am trying to run an Autofilter using multiple criteria. I have no issue with Criteria2, but when I try to enter AutoFilter Criteria3 I end up with a runtime error.



Code that works for 2:
Selection.AutoFilter Field:=1, Criteria1:=">03-003", Operator:=xlAnd, _
Criteria2:="<>*x*"

Trying to enter for 3:
Selection.AutoFilter Field:=1, Criteria1:=">03-003", Operator:=xlAnd, _
Criteria2:="<>*x*", Operator:=xlAnd, Criteria3:="<>Pending"

Am I missing something simple?

Last edited by coxjamd; 01-17-2013 at 01:15 PM. Reason: typo for Criteria3
Reply With Quote
  #2  
Old 01-17-2013, 01:37 PM
coxjamd coxjamd is offline AutoFilter Criteria3 Windows XP AutoFilter Criteria3 Office 2010 32bit
Novice
AutoFilter Criteria3
 
Join Date: Jan 2012
Posts: 6
coxjamd is on a distinguished road
Default

On further research it appears that AutoFilter will only filter by 2 criteria. I have a sheet with multiple variables in Column "A". I need to filter out the criteria being less than 03-003 AND not containing "x" and not containing "Pending". Moving some data to another column to be filtered is not an option. This is a live document where rows are regularly being added so I am not sure how an array can help. Any ideas?
Reply With Quote
  #3  
Old 01-17-2013, 02:24 PM
Colin Legg's Avatar
Colin Legg Colin Legg is offline AutoFilter Criteria3 Windows 7 32bit AutoFilter Criteria3 Office 2010 32bit
Expert
 
Join Date: Jan 2011
Location: UK
Posts: 369
Colin Legg will become famous soon enough
Default

If you need more than 2 criteria on the same column then your immediate choices are:
  • Use a helper column
  • Use the advanced filter instead of an autofilter. Using the advanced filter will require a criteria range to be set up.
__________________
Colin

RAD Excel Blog
Reply With Quote
Reply

Tags
autofilter, criteria3



Other Forums: Access Forums

All times are GMT -7. The time now is 12:39 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft