VPN if your hacked?

I know a VPN keeps you safe if you are connecting to a open network or WiFi.

What if your network at home that's password protected is hacked and a 3rd party is trying to get in aka a hacker.

If you connect to a VPN does it make it to where your web browsing and password protected websites are safe? I know or I think your apps are still of course under attack, but what about your web browser?