Thanks p45cal,

it indeed works in the example on my private pc.

But somehow, when I try to run the script in another excel file or from another tab it shows the error "no cells found".