Forum Discussion

SamFares40's avatar
SamFares40
Copper Contributor
Apr 15, 2020
Solved

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

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

  • 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.

4 Replies

  • JKPieterse's avatar
    JKPieterse
    Silver Contributor
    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.
    • RRuesenberg's avatar
      RRuesenberg
      Copper Contributor

      JKPieterse  - When i select that setting feature it works while i am in the document. Even after saving, i open the document again the setting default back. I can not unhide and hide columns 

      • lauracap's avatar
        lauracap
        Copper Contributor

        RRuesenberg​ did you ever get a response to fixing your hide/unhide columns when you have protected a sheet?  I have tried everything in the world to get this working including using AI help...but no success yet.

Resources