I have a column called Color, and it is filtered, so I can select\deselect desired Colors.
I recorded a macro to find out how to filter the column for all colors except Blue, Green, and Orange.
The only color that was left was red.
The macro created was as follows:
ActiveSheet.Range("$A$1:$B$5").AutoFilter Field:=1, Criteria1:="Red"
The problem with this code is that it will not work for a generic case, because it is including "Red" and excluding everything else, whereas what I need is to exclude Blue, Green, and Orange, and include everything else.
The reason I need a different code is that my color choices can change based on what I get from the database.
For example, if I pull data and create filter automatically, I could have the color Pink in my list, by my code would be broken, because Pink would not be selected, only Red would be selected.
Any tips on fixing this problem? One idea would be to select everything that is un-selected, and de-select everything that is selected (if there is any vba code to do that). With this strategy, I would select Blue, Green, and Orange, then I would run the swap code.