NVIT
asked on
Delete row if not contains certain text
I wanted to record this but I don't think Excel can record conditionals, i.e. IF, ELSE, etc. So, I thought this may be easy for an Excel VB expert.
I need a Excel macro that will...
- Search whole worksheet and will delete a row if the Project Title cell...
- does not end with string: / total Total Fee
- and does not start with at least a minimum length 4 character number string. These pass: 2100, 9812
- and those same strings may also be like: 210012, 210012A, 210012A1, 98123D
I've attached a sample spreadsheet.
DelRowIfNotProject.xlsx
I need a Excel macro that will...
- Search whole worksheet and will delete a row if the Project Title cell...
- does not end with string: / total Total Fee
- and does not start with at least a minimum length 4 character number string. These pass: 2100, 9812
- and those same strings may also be like: 210012, 210012A, 210012A1, 98123D
I've attached a sample spreadsheet.
DelRowIfNotProject.xlsx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
According to the rules you posted, it shouldn't delete those lines...
- does not end with string: / total Total Fee
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I assume you need to replace And with Or in line#7 in the end.
Could be. I read the rules as being 2 separate conditions, not the one.
ASKER
@Wayne
I meant it as:
- does not end with string: / total Total Fee
- [b]and[/b] does not start with at least a minimum length 4 character number string. These pass: 2100, 9812
Please forgive me for not being clear.
@Subohd
That's it. It works.
Thank you both. This is very helpful.
I meant it as:
- does not end with string: / total Total Fee
- [b]and[/b] does not start with at least a minimum length 4 character number string. These pass: 2100, 9812
Please forgive me for not being clear.
@Subohd
That's it. It works.
Thank you both. This is very helpful.
You're welcome. Glad we could help.
ASKER
It's not deleting the "001 Billing Group / total Total Fee" lines. Is it a fairly quick fix?
It's deleting the rest, though. Thanks for that.