nyrangers1994
New Member
- Joined
- Aug 30, 2011
- Messages
- 17
I have an Excel file with a table (Listobject) that has a column called "Project". In the Project field, there are many varying values and the list is always expanding. Some records in the table have a value for Project called "N/A" and I'm trying to create a macro that automatically filters out any records with N/A without the user having to click the filter button and unchecking N/A.
When I tried recording a macro to see what the basic code would be, I saw that it provides an array for the criteria of the values that should be in, not the ones that should be filtered out:
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=6, Criteria1:= _
Array("Project 1", "Project 2", "Project 3", "Project 4", "Project 5", _
"Project 6", "Project 7"), Operator:=xlFilterValues
The problem I have though is that only the N/A values should be filtered out, but everything else should stay in, and these records that should stay in will always have an expanding and varying list of Projects. To avoid continually having to keep the macro up to date, is there a macro I can create that filters out the "N/A" as opposed to filtering in everything else?
Thanks for your help.
When I tried recording a macro to see what the basic code would be, I saw that it provides an array for the criteria of the values that should be in, not the ones that should be filtered out:
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=6, Criteria1:= _
Array("Project 1", "Project 2", "Project 3", "Project 4", "Project 5", _
"Project 6", "Project 7"), Operator:=xlFilterValues
The problem I have though is that only the N/A values should be filtered out, but everything else should stay in, and these records that should stay in will always have an expanding and varying list of Projects. To avoid continually having to keep the macro up to date, is there a macro I can create that filters out the "N/A" as opposed to filtering in everything else?
Thanks for your help.