ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   lock formula in excel (https://www.excelbanter.com/excel-discussion-misc-queries/31088-lock-formula-excel.html)

jimdk

lock formula in excel
 
Is it possible to lock a formula in Excel so that it cannot be changed, but
still allow the cell content to be changed?

Dave Peterson

A cell can contain a formula or a value.

If you type in that value, then you've lost the formula.

Are you saying you want to let the user override the results of the formula, but
not use a different formula?

If yes, then how about an alternative:

Use 3 cells (say A2, B2 and C2):

Put your formula in A2 (with the label Default in A1)
put the label Override in B1
Then use a formula in C2:
=if(b2="",a2,b2)
And put "Use this Value" in C1.

Then lock all your cells and come back and unlock the cells that the users can
type in.

========
An alternative would be to have an event macro look for a change. If it sees a
value in that cell, then it's ok.

If it sees a formula, it throws it away and plops the original formula into the
cell.

But personally, I like the layout of 3 columns. It's easier to see what's
happening.


jimdk wrote:

Is it possible to lock a formula in Excel so that it cannot be changed, but
still allow the cell content to be changed?


--

Dave Peterson


All times are GMT +1. The time now is 03:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com