Hi,
Indeed, main problem is that after first delete, the cell assigned to FoundOne range variable is deleted (it was first cell found with Find, so it's first meeting criteria in
loop)
so next call to:
generates an error. because VBA cannot evaluate FoundOne.value (as FoundOne has been already deleted)
One possibility is to assign "just found" FoundOne.value to a variable, and then compare cell.value with that variable. Or (shall be quicker) just repeat Find, not look for each cell to compare with Find result, like :
PS. It's not necessary, but makes reading easier if you declare all variables. for instance in the code
declarations would make reading easier, and (may be it is declared somewhere public, because otherwise would cause an error , lastrow has no assigned value
Bookmarks