I have a MacbookPro from 2022 with Ventura and I would like to use my iMac from spring 2010 (Yosemite) as an external monitor for my MacbookPro. Is this possible and if yes what do I have to do to make this work? I tried connecting the two computers with a cable (Miniport for the iMac and HDMI for the MacbookPro) and then pressing “Alt F2” on the iMac but this did not work.
I do not use the iMac as a computer anymore but I would like to use it as an external monitor as the monitor is still very good.
You can't. It isn't possible. Your Mac must be a 2019 model or earlier with macOS Catalina or earlier installed. This won't work with any 2020 models or later, or even 2019 models or earlier unless you are willing to downgrade to Catalina, which is not a good trade-off.
Even if it were, a 2010 screen is very much inferior to what is available today. You can get a 4K screen for less than $300. More pixels, better brightness and contrast, lighter, more input options. And it is probably much more energy efficient too.
I think you are thinking of the "Target Display Mode." But that is only available if you have the right older iMac and you are using an older version of macOS. But even then, still not a good screen to use in 2023.