In this article, we are going to learn how to extract record with not criteria through VBA in Microsoft Excel.
Let’s take an example to understand how we can put the filter and select the criteria and then take the required action:-
We have data in range A:G columns, in which column A contains Name, column b contains Address, column C contains city, column D region, column E country, column F phone number and column G contains criteria.
We want to write the Macro to put the filter and then filter the data according to Not contains data in G column and then delete the Not contains data. And then remove the filter and show all data.
To extract record with Not criteria follow below given steps:
Sub Delete_NotEligible() ActiveSheet.Range("$A$1:$G$15").AutoFilter Field:=7, Criteria1:="<>" Rows("2:12").Select Selection.Delete Shift:=xlUp Range("B1").Select Selection.AutoFilter End Sub
In this way, we can put the filter on the basis of particular criteria, and then delete the data.
We would love to hear from you, do let us know how we can improve, complement or innovate our work and make it better for you. Write us at firstname.lastname@example.org
The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.