High CPU Usage After Protect/Hide Excel Sheets

New Contributor

Hi,

 

I am using VBA inside Excel to try to hide or protect some sheets. Because of my work requirements, so I need to hide/unhide or protect/unprotect sheets each time users navigate to another sheet.

 

However, I have a trouble with high CPU Usage of Excel after I apply some of the follow VBA codes.

 

1. VBA Hide

 

 

ActiveSheet.Visible = False
ActiveSheet.Visible = True

 

 

 

 

2. VBA Protect

 

 

ActiveSheet.Unprotect Password:="password"
ActiveSheet.Protect Password:="password"

 

 

 

I have checked, and there is no calculation in between unhide and hide or unprotect and protect, but the problem with high CPU usage keeps happening. It increases from as low as under 1% usage to more than 20% usage (and keep going up if I continue run those VBA without decreasing).

 

FYI: I have used Core i5-8265U 1.6Ghz with 8GB RAM.

 

If you know anything related to this, please help me or give me advice.

 

Thank you.

 

 

2 Replies
Try protecting without a password, it should increase the speed significantly.

@Jan Karel Pieterse I know about the speed, but what I want to ask is about the remained high CPU usage after that. Normally, the CPU usage will reduce, but in these cases, it keeps at a high CPU usage.