Unprotect cells

Bob Hustead

New Member
Joined
Jul 20, 2007
Messages
10
Hello,

This is actually part of a previous thread, but I wanted to try and explain the issue better than I have.

I have cells protected in a sheet and unprotected cells. I also have buttons to toggle rows and columns. The buttons were not functioning properly due to the protection. To overcome this, the following code is inserted in the button modules-this is the entire module code:

Sub ToggleHideB()
ActiveSheet.Unprotect "Pass"
With ActiveSheet.Buttons(2)
If .Caption = "Make C thru F visible" Then
Range("C:F").EntireColumn.Hidden = False
.Caption = "Hide C thru F"
Else
Range("C:F").EntireColumn.Hidden = False
Range("C:F").EntireColumn.Hidden = True
.Caption = "Make C thru F visible"
End If
ActiveSheet.Protect "Pass"
Application.ScreenUpdating = True
End With
End Sub

This works like a charm. The problem is that when I click one of the buttons, my unprotected cells partially revert to protected cells. I am unable to highlight the cell or add comments.

By the way, I have 2002 version of Excel with expanded protection.

I have added code to overcome this. I have tried it in the sheet code and in the workbook code. This is the code:

Private Sub NoRestriction()
ActiveSheet.EnableSelection = xlNoRestriction
End Sub

You have all helped a great deal with this spreadsheet!!!

Thank you,

Bob Hustead
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Forum statistics

Threads
1,181,647
Messages
5,931,207
Members
436,783
Latest member
darkwingduck1

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top