Macro to Delete Entire Rows Based on Predefined Criteria (Text)Expanded Search

0

I am working with one of your site's established macros " Delete Entire Rows Based on Predefined Criteria (Text).  It works very well but after I entered 55 texts in the Search part it would not let me add any more.  Can you provide a modified macro code to allow the macro to search for more texts, e.g. an unlimited number if possible?  I have attached a sample file containing around 400 rows of text.  Five of them are highlighted as ones which the macro will delete.  

Thanks,

Alan

Answer
Discuss

Discussion

No sample file is attached to your question. You can edit it and upload the file.
don (rep: 1382) Nov 14, '16 at 7:52 am
The only section of the macro that I have edited is to insert items into the Search as follows:  

SearchItems = Split("102-1 RBR,152.1 APCO,14403228,14409022,14409033,14500071,14500072,14441704,14463010,14541300,14583109,6308300 SLEEVE,7164104 N IMPELLER KIT 3127 CI-,7164105 N IMPELLER KIT 3127 CI-,7164106 IMPELLER KIT 489 FOR 31,822453 NUT,833180 BALL BEARING R/B 833236,833465 ROLLER BRG NU315ECPVLO24,2015905026,22015905027,26701800005,30451816684,30850921402,30850921412,30851832023,30851832033,30851832605,30851832783,31401801294,31521814353,3201-464,33001813346,841538,841539,6085800 WATER JACKET,22814-662,25152-276,27788-032,31513-015 SHAFT SLEEVE SST,31671-001,38649-015,4991G,83 SEAL LINER - 14080,S5087A KEY,T4A3SB,T6A3SB,MPEDFK-W,W2T294099 TRANS ASSY4-20MA0-10,W2T294101 TRANS.ASSY 4-20MA 0-2,1/4in.GALVANIZED SHACKLE,5/16in.GALVANIZED SHACKLE,3388000P,36X48A 36 X 48 ACCESS COVER LIG (36X48A 36 X 48 ACCESS COVER LIGHT DUTY),4292701X,61207709,BC01001AA6 BIRD CAGE TRANSDUCER (BC01001AA6 BIRD CAGE TRANSDUCER 5PSI W/60'),96690125 PACKING RINGS,31607 BALANCED", ",")
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
   
Alan L Nov 14, '16 at 11:26 am
Ok, well, did you try the solution I included below in my answer?
don (rep: 1382) Nov 15, '16 at 9:27 am
Add to Discussion

Answers

0

The Macro

Without seeing the macro that you used, after you edited it, I can only guess what might have gone wrong. However, without seeing it, I can give you a simple(ish) solution that might work.

Create another macro that calls the original macro multiple times.

This requires that you add a variable to the original macro like this:

Sub Delete_Based_on_Criteria(searchTermsVar)

Edit this line of the original macro:

SearchItems = Split("INPUT TEXT HERE, INPUT TEXT HERE", ",")

Change it to:

SearchItems = searchTermsVar

New macro:

Sub call_delete_row_macro()

SearchItems = Split("INPUT TEXT HERE, INPUT TEXT HERE", ",")
Call Delete_Based_on_Criteria(SearchItems)

'Repeat as needed
SearchItems = Split("INPUT TEXT HERE, INPUT TEXT HERE", ",")
Call Delete_Based_on_Criteria(SearchItems)

End Sub
Discuss

Answer the Question

You must create an account to use the forum. Create an Account or Login