zombiemaster
Board Regular
- Joined
- Oct 27, 2009
- Messages
- 245
I have a spreadsheet with 8 columns of data. In the 3rd column, I have a variety of codes that start with 'B', 'D' and O'.
However, those are just the ones that we KNOW OF in today's world. Management isn't sure if there could be other potential codes or not, and want me to include VBA that will split any 'new' codes that come along in the future out into it's own tab.
So to start with, I wanted to insert a filter in that column that finds anything OTHER than those three known codes. I thought this would work:
But it doesn't work - I'm getting a runtime error.
I know Excel can't do more than two qualifiers if doing a filter manually, but I thought I could add "Criteria3" within the code and it would work - was that an incorrect assumption? If I take out that third criteria, it works and all I see are the "O" entries.
Once I get this piece nailed down on how to identify if there are unknown codes, I will need a way to split those out to another sheet...but first things, first!
Thanks for any help,
~ZM~
However, those are just the ones that we KNOW OF in today's world. Management isn't sure if there could be other potential codes or not, and want me to include VBA that will split any 'new' codes that come along in the future out into it's own tab.
So to start with, I wanted to insert a filter in that column that finds anything OTHER than those three known codes. I thought this would work:
Code:
ActiveSheet.Range("$D$3:$D" + endRow$).AutoFilter Field:=1, Criteria1:="<>D*", _
Operator:=xlAnd, Criteria2:="<>B*", Operator:=xlAnd, Criteria3:="<>O*"
But it doesn't work - I'm getting a runtime error.
I know Excel can't do more than two qualifiers if doing a filter manually, but I thought I could add "Criteria3" within the code and it would work - was that an incorrect assumption? If I take out that third criteria, it works and all I see are the "O" entries.
Code:
ActiveSheet.Range("$D$3:$D" + endRow$).AutoFilter Field:=1, Criteria1:="<>D*", _
Operator:=xlAnd, Criteria2:="<>B*"
Once I get this piece nailed down on how to identify if there are unknown codes, I will need a way to split those out to another sheet...but first things, first!
Thanks for any help,
~ZM~