Hello I have protected a sheet apart from a few cells that have drop downs for user selection. These selections then drive the comments in other cells. In short it is an instuctions sheet depending on the inputs, once the user has done they click a button to reset all the empty cells. This is fine for the drop down cells which are protected but naturally causes an error on the cells that are protected but dispaly the instructions. Is there a way to include some code to get around this?
This si the button code:
Range("D10:D55").Select
Selection.ClearContents
Range("D10").Select
End Sub
Assume the instructions are in E10:E15
Thanks Darren.
Debug error
-
- Administrator
- Posts: 78608
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: De bug error
You can unprotect the sheet in your code, then clear some cells (you don't need to select them for that), and finally protect the sheet again:
ActiveSheet.Unprotect
Range("D10:D55").ClearContents
ActiveSheet.Protect
If you protected the sheet with a password, supply it in the code:
ActiveSheet.Unprotect Password:="secret"
Range("D10:D55").ClearContents
ActiveSheet.Protect Password:="secret"
ActiveSheet.Unprotect
Range("D10:D55").ClearContents
ActiveSheet.Protect
If you protected the sheet with a password, supply it in the code:
ActiveSheet.Unprotect Password:="secret"
Range("D10:D55").ClearContents
ActiveSheet.Protect Password:="secret"
Best wishes,
Hans
Hans