SOLVED

VBA to hide set of columns is in conflict with protecting the sheet

Highlighted
Occasional Contributor

Hello,

i created VBA to hide a set of columns. But when i try to protect  certain cells in  sheet including the columns that will be hiden, i get the error message" Run time error1004,  Unable to set the hidden property of the Range class".

 

I am not sure how to fix it or if there is a better way to do it.

 

Regards,

Sam

2 Replies
Highlighted
Best Response confirmed by SamFares40 (Occasional Contributor)
Solution
When you protect a worksheet, one of the options is to allow "Format Columns". If you check that box you can hide and unhide columns on a protected sheet.
Highlighted