Hello Denja,
If you are getting an "Autofilter" error message in the second sample you have supplied, its because of the empty sheet. Delete the empty sheet.
Next, remove the sort line of code:-
It wasn't really necessary.
Hence the amended code should look like this:-
Another way around the empty sheet problem (assuming you don't want to delete it) is to add a little more to the code as follows:-
The additional bits in red font should prevent any error messages due to empty worksheets.
BTW, the code won't return anything to the "Demand" sheet in the second sample as there aren't any expired dates or shortly to expire dates.
I hope that this helps.
Cheerio,
vcoolio.
Bookmarks