Avatar of finnstone
finnstone
 asked on

vba errror

when i run the attached book for macro named deleterows2, i get an object not found end or rows error
delete-specia-characters-code---pag.xlsm
VBAMicrosoft ExcelMicrosoft Office

Avatar of undefined
Last Comment
Tracy

8/22/2022 - Mon
Yuval_Shohat

if I understand your code correctly you are checking each line by regexp with the purpose of removing any line with unprintable characters.
The thing is that in this case the regexp found non so it never got to the section that sets d to something else than the original "nothing" value.
the If x.Test(c.Value) Then in this case is never true, so when it gets to the d.EntireRow.Delete, d = nothing and does not have any line value.

assuming your regex is done correctly, you should check d's value and if  d="nothing" then you should skip the delete or have something else.

Good luck.
-=Yuval=-
ASKER CERTIFIED SOLUTION
Rgonzo1971

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Tracy

No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Accept: Rgonzo1971 (https:#a42449436)

If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

broomee9
Experts-Exchange Cleanup Volunteer
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes