Hello,
I'm new to the forum and using VBA. I would like some assistance in writing a macro that would delete a row based on multiple criteria that I would insert into an input box or pop-up. The criteria could be plain text, numeric, or alphanumeric configurations. Any assistance would be much appreciated. Attached is an example of the spreadsheet with the criteria that needs removed highlighted.
The criteria is this:
Keep: stock location 1291
Keep: cost code S2012
Delete all others
SteveGlaetti,
What is your criteria for keeping or deleting? In your example you show what you want to be deleted, but how to determine this. What do you look at? Is there some other info that tells you to delete?
Charles
There are other ways to do this, this is but 1 !
Be Sure you thank those who helped.
IF YOU'RE SATISFIED BY ANY MEMBERS RESPONSE TO YOUR ISSUE PLEASE USE THE STAR ICON AT THE BOTTOM LEFT OF THE POST UNDER THEIR NAME.
Charles,
Thanks for the reply. I guess what I'm looking for is the option through an input box to choose what rows I would like to keep or sort based on certain criteria. In the attached sheet I want to be able to choose all of the rows that have EP3981,1291,S2007 and EP3981,1287,S2007 but the flexibility to choose up to 5 configurations with 1-5 fields each.
Thanks
Hi,
I placed a button in this copy. When you click it it should display a userform. You will be able to select 1 or more Items to delete.
It looks at column B for the Items. However when I looked at your example, it seems you are wanting to remove "Duplicates". If thats the case then you will need a different code.
Charles
There are other ways to do this, this is but 1 !
Be Sure you thank those who helped.
IF YOU'RE SATISFIED BY ANY MEMBERS RESPONSE TO YOUR ISSUE PLEASE USE THE STAR ICON AT THE BOTTOM LEFT OF THE POST UNDER THEIR NAME.
Charles,
The situation that I have is that the fields I may want to keep can be anywhere from A-Z in the columns. In one case I may want to keep the specific criteria in columns A,B,H,K or in another I may want to keep B,D,J,K. This will change depending on the report I place in the sheet. The criteria could be one criteria or a group of criteria. I hope this explains a little more I appologize for the confusion I'm just not sure how to explain it. In the attached example I would like to keep all of the rows that have the following combinations.
a,b,c
b,b,a
a,a,b
Steve,
Sorry for the delay. In what you are trying to do I do not have an answer, because the criteria keeps changing. In one example you say the criteria is in column A,B,H and K. Then the criteria may changes. This would be difficult to code because of the "Unknown" criteria. Perhaps another member with more knowledge can come up with an answer. The only thing I can think of is you know were the data is before hand you can have a code that will prompt you for the required range and then load the listbox so you can make your selection for deletion.
Charles
There are other ways to do this, this is but 1 !
Be Sure you thank those who helped.
IF YOU'RE SATISFIED BY ANY MEMBERS RESPONSE TO YOUR ISSUE PLEASE USE THE STAR ICON AT THE BOTTOM LEFT OF THE POST UNDER THEIR NAME.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks