Changing data value in Excel cell also overwrites function

%3CLINGO-SUB%20id%3D%22lingo-sub-2851649%22%20slang%3D%22en-US%22%3EChanging%20data%20value%20in%20Excel%20cell%20also%20overwrites%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2851649%22%20slang%3D%22en-US%22%3E%3CP%3EI%20created%20a%20simple%20pounds%20and%20kilograms%20unit%20conversion.%20However%20when%20I%20try%20to%20change%20the%20value%20in%20the%20cell%2C%20it%20also%20overwrites%20the%20function.%20Is%20there%20any%20way%20to%20change%20the%20value%20without%20changing%20the%20function%3F%26nbsp%3B%20In%20the%20image%20below%2C%20I%20want%20to%20change%20the%20value%20of%20kilograms%20from%201587.6%20to%201400%20to%20see%20what%20it%20is%20in%20pounds.%20However%20when%20I%20double%20click%20the%20cell%20and%20change%20the%20value%20to%201400%2C%20it%20changes%20the%20function%20along%20with%20it%20to%201400.%20I%20would%20like%20to%20make%20it%20where%20the%20function%20is%20permanent%20and%20cannot%20be%20changed%20when%20I%20try%20to%20input%20a%20value%20of%20data.%20Thanks%20in%20advance!%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22bobsampson_0-1634334353325.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F317794i7798B7AE89C345F6%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22bobsampson_0-1634334353325.png%22%20alt%3D%22bobsampson_0-1634334353325.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22bobsampson_1-1634334639735.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F317796i76119F8DAC9CEAE8%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22bobsampson_1-1634334639735.png%22%20alt%3D%22bobsampson_1-1634334639735.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2851649%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2851682%22%20slang%3D%22en-US%22%3ERe%3A%20Changing%20data%20value%20in%20Excel%20cell%20also%20overwrites%20function%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2851682%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1187000%22%20target%3D%22_blank%22%3E%40bobsampson%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThat%20is%20not%20possible.%20A%20cell%20can%20contain%20a%20fixed%20value%20or%20a%20formula%2C%20not%20both.%3C%2FP%3E%0A%3CP%3EBut%20you%20can%20use%20VBA%20code%20to%20accomplish%20it.%3C%2FP%3E%0A%3CP%3ESee%20the%20attached%20workbook.%20You'll%20have%20to%20allow%20macros%20when%20you%20open%20it.%3C%2FP%3E%0A%3CP%3ETo%20view%20the%20code%2C%20right-click%20the%20sheet%20tab%20and%20select%20'View%20Code'%20from%20the%20context%20menu.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

I created a simple pounds and kilograms unit conversion. However when I try to change the value in the cell, it also overwrites the function. Is there any way to change the value without changing the function?  In the image below, I want to change the value of kilograms from 1587.6 to 1400 to see what it is in pounds. However when I double click the cell and change the value to 1400, it changes the function along with it to 1400. I would like to make it where the function is permanent and cannot be changed when I try to input a value of data. Thanks in advance! 

bobsampson_0-1634334353325.png

 

bobsampson_1-1634334639735.png

 

1 Reply

@bobsampson 

That is not possible. A cell can contain a fixed value or a formula, not both.

But you can use VBA code to accomplish it.

See the attached workbook. You'll have to allow macros when you open it.

To view the code, right-click the sheet tab and select 'View Code' from the context menu.