I have a worksheet that I make my employees fill out, and I have calculated cells that I want to lock so they cannot change them. I have selected the cells and selected properties and ensured that the "lock" checkbox is checked. When I protected the worksheet/workbook the "export to csv" macro button stopped working. In order to enable the macro to be completed I inserted this VB code into the Workbook:
Private Sub Workbook_Open()
Dim wSheet As Worksheet
For Each wSheet In Worksheets
wSheet.Protect Password:="password", _
UserInterFaceOnly:=True
Next wSheet
End Sub
This worked but had the unintended side effect of allowing my locked formulas to be able to be edited even though they were locked. Only cells containing non-formula values remained locked. What is the proper way to allow macros but still lock formula cells?
.Value = Value
on the formula block and reassert the formulas with.Formula = "..."
when you want the cells recalculated on new data. The event sub Worksheet_Calculate is considered a 'macro'. – user4039065UserInterFaceOnly
at the end of the macro. Please take a look at my answer and let me know if this works. I don't have access to excel right now to test it. – M--UserInterFaceOnly
to true would resolve the issue? – M--