If you figure it out, do let me know
Cats have a natural love for high places. Even when attempting to block their access, our kitties are pretty clever when they're determined to be in a certain spot, aren't they! Would it be possible to place a large item (heavy and sturdy, not something that could accidentally fall) on top of the object where they're wanting to be, for instance in the space between the top of a bookshelf and ceiling? Another idea is to make these spots less appealing with something like double sided tape which they will avoid because of their little paws sticking to it, while providing a more suitable spot for them such as a tall cat tree.
Another point, though, is, unless the area is dangerous for them, just go ahead and let them be up there to watch over their domain after remove any objects that could present a problem being knocked over or broken during their climb and decent. If they got up there, I would bet they'll figure out how to get down when they're ready.