Protection Problems when Macros are involved

DragonSoft

New Member
Joined
Oct 9, 2008
Messages
21
I have a work book with 6 work sheets, I use macros the change the headers of columns depending on the type of data being entered. Problem is my boss wants the worksheet protected so the people using the spreadsheet do not mess up the headers by typing in them "by accident". When I lock all the cells that no one are to type in I get the debug error when changing the data type (I know it is the macro because if I hit the debug button it goes to the line that changes the header) If I unlock that cell the error skips by that line of code but stops on the next line that try's to change the locked cell. So the question is "How do I lock cells that the data in them is pragmatically produced"?
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Via code, you can protect a sheet using UserInterFaceOnly:=true

this allows code to make changes to protected cells.

Add a workbook_open event that loops through the sheets, protecting them with that additional argument.
This means users CANNOT manually protect sheets.
 
Upvote 0

Forum statistics

Threads
1,202,987
Messages
6,052,932
Members
444,616
Latest member
novit19089

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
Back
Top