VPN is a good solution for a lot of issues you might experience online like accessing blocked sites, hiding your browsing activity, etc...
But does a VPN protect you from Hackers?
Conclusion: Yes, a VPN will protect you from many cyberattacks that require access to your IP address. However, it might not be of much help against more complex attacks such as malware.
Attacks a VPN Can't Prevent
Basically, a VPN won't protect you against attacks that don't require access to your IP address. Such as malware attacks and phishing attacks.
Some attackers can gain control of your device by injecting malicious software into your system. In such cases, a VPN won't be able to help you.
Also read: Some Useful PC Tricks you should know...
You should definitely use a VPN on a public network to protects your privacy. But a VPN can't simply type of cyber attack. Some attacks are very complex.
Some of the cyber attacks that a VPN can stop.
MITM (Man-in-the-Middle)
Remote Hacking
DDoS/DoS Attack
Conclusion:
Yes, a VPN will protect you from many cyberattacks that require access to your IP address. However, it might not be of much help against more complex attacks such as malware.