How can i protect a calculated column in a table from being edited but allowing users to add rows?

%3CLINGO-SUB%20id%3D%22lingo-sub-3298842%22%20slang%3D%22en-US%22%3EHow%20can%20i%20protect%20a%20calculated%20column%20in%20a%20table%20from%20being%20edited%20but%20allowing%20users%20to%20add%20rows%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3298842%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%20I%20have%20a%20simple%20example%20of%20a%20data%20entry%20form%20(on%20an%20excel%20table)%20with%204%20columns%20for%20entry%20of%20quarterly%20financial%20data.%20i%20have%20a%205th%20column%20that%20adds%20up%20the%204%20quarters%20into%20an%20annual%20cost%20per%20line.%20this%20is%20a%20calculated%20column%20in%20the%20table%20so%20adding%20rows%20automatically%20adds%20the%20calculation%20to%20sum%20up%20the%20annual%20costs.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20need%20to%20be%20able%20to%20lock%20the%20annual%20column%20to%20stop%20editing%20while%20allowing%20new%20rows%20to%20be%20added.%20This%20is%20because%20i%20need%20to%20distribute%20the%20entry%20across%20a%20number%20of%20users%20and%20need%20to%20ensure%20they%20dont%20edit%20calculated%20columns.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20i%20protect%20the%20column%20and%20lock%20the%20sheet%2C%20i%20get%20an%20error%20adding%20rows%20saying%20i%20need%20to%20unlock.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20advice%20on%20what%20im%20doing%20wrong%20please%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3298842%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3302470%22%20slang%3D%22en-US%22%3ERe%3A%20How%20can%20i%20protect%20a%20calculated%20column%20in%20a%20table%20from%20being%20edited%20but%20allowing%20users%20to%20add%20row%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3302470%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1377080%22%20target%3D%22_blank%22%3E%40TonyCrabb%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFor%20example%3A%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-visual-basic%22%3E%3CCODE%3ESub%20AddRow()%0A%20%20%20%20Dim%20strPassword%20As%20String%0A%20%20%20%20strPassword%20%3D%20%22secret%22%0A%20%20%20%20Application.ScreenUpdating%20%3D%20False%0A%20%20%20%20ActiveSheet.Unprotect%20Password%3A%3DstrPassword%0A%20%20%20%20ActiveSheet.ListObjects(1).ListRows.Add%20AlwaysInsert%3A%3DFalse%0A%20%20%20%20ActiveSheet.Protect%20Password%3A%3DstrPassword%0A%20%20%20%20Application.ScreenUpdating%20%3D%20True%0AEnd%20Sub%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3302451%22%20slang%3D%22en-US%22%3ERe%3A%20How%20can%20i%20protect%20a%20calculated%20column%20in%20a%20table%20from%20being%20edited%20but%20allowing%20users%20to%20add%20row%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3302451%22%20slang%3D%22en-US%22%3Ethanks%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F127945%22%20target%3D%22_blank%22%3E%40Hans%20Vogelaar%3C%2FA%3E.%20Any%20advice%20on%20how%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3302296%22%20slang%3D%22en-US%22%3ERe%3A%20How%20can%20i%20protect%20a%20calculated%20column%20in%20a%20table%20from%20being%20edited%20but%20allowing%20users%20to%20add%20row%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3302296%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1377080%22%20target%3D%22_blank%22%3E%40TonyCrabb%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20do%20need%20VBA%20for%20this%2C%20sorry!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3302286%22%20slang%3D%22en-US%22%3ERe%3A%20How%20can%20i%20protect%20a%20calculated%20column%20in%20a%20table%20from%20being%20edited%20but%20allowing%20users%20to%20add%20row%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3302286%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F722750%22%20target%3D%22_blank%22%3E%40NikolinoDE%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EDoes%20anybody%20else%20have%20any%20thoughts%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3301622%22%20slang%3D%22en-US%22%3ERe%3A%20How%20can%20i%20protect%20a%20calculated%20column%20in%20a%20table%20from%20being%20edited%20but%20allowing%20users%20to%20add%20row%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3301622%22%20slang%3D%22en-US%22%3EI%20don't%20know%20of%20any%20other%20approach%20without%20VBA%2C%20but%20this%20doesn't%20have%20to%20be%20the%20case%2C%20it%20may%20be%2C%20I%20don't%20know%2C%20that%20there%20could%20be%20other%20ways%2C%20but%20these%20are%20beyond%20my%20knowledge.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3301599%22%20slang%3D%22en-US%22%3ERe%3A%20How%20can%20i%20protect%20a%20calculated%20column%20in%20a%20table%20from%20being%20edited%20but%20allowing%20users%20to%20add%20row%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3301599%22%20slang%3D%22en-US%22%3EI%20am%20looking%20for%20something%20more%20robust%20than%20that.%3CBR%20%2F%3E%3CBR%20%2F%3EIs%20there%20really%20no%20inbuilt%20way%20in%20Excel%20to%20be%20able%20to%20instert%20a%20row%20into%20a%20table%20while%20protecting%20a%20calculated%20column%3F%20That%20seems%20such%20a%20basic%20need%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3301593%22%20slang%3D%22en-US%22%3ERe%3A%20How%20can%20i%20protect%20a%20calculated%20column%20in%20a%20table%20from%20being%20edited%20but%20allowing%20users%20to%20add%20row%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3301593%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1377080%22%20target%3D%22_blank%22%3E%40TonyCrabb%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3EHere%20is%20a%20solution%20with%20data%20validation.%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3EThis%20presented%20procedure%20protects%20the%20cells%20from%20accidentally%20overwriting%20the%20cells.%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3EHowever%2C%20the%20locked%20cell%20can%20still%20be%20deleted%20with%20the%20Delete%20key.%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3EProtected%20cells%20can%20also%20be%20overwritten%20using%20the%20copy%20and%20paste%20function.%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3EThe%20function%20presented%20does%20not%20represent%20particularly%20good%20protection%2C%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3Ebut%20it%20is%20sufficient%20in%20practice%20in%20many%20cases.%3C%2FSPAN%3E%3C%2FSPAN%3E%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3EOtherwise%20it%20would%20have%20to%20be%20done%20with%20VBA%2C%20but%20it%20takes%20time%2C%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3E%3CSPAN%20class%3D%22%22%3Ewhich%20I%20unfortunately%20don't%20have%20available.%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHope%20I%20was%20able%20to%20help%20you%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fexcel-blog%2Fmeet-niko-chatzoudis-excel-forum-contributor%2Fba-p%2F2941385%22%20target%3D%22_blank%22%3ENikolinoDE%3C%2FA%3E%3C%2FP%3E%3CP%3EI%20know%20I%20don't%20know%20anything%20(Socrates)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3300362%22%20slang%3D%22en-US%22%3ERe%3A%20How%20can%20i%20protect%20a%20calculated%20column%20in%20a%20table%20from%20being%20edited%20but%20allowing%20users%20to%20add%20row%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3300362%22%20slang%3D%22en-US%22%3E%3CP%3ESome%20additional%20context....%3CBR%20%2F%3EWindows%2010%20PC%3CBR%20%2F%3EMIcrosoft%20365%20Apps%20for%20Enterprise%3CBR%20%2F%3EExcel%20Version%3A%20Excel%20for%20Microsoft%20365%20MSO%20(16.0.13127.21886)%2032-bit%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3EIn%20the%20attached%20file%2C%20i%20have%20a%20simple%20table%20with%20one%20calculated%20column.%3C%2FP%3E%3CP%3EI%20have%20unprotected%20the%20date%20entry%20columns%20(title%2C%20Q1-Q4%20and%20left%20the%20annual%20caculated%20column%20locked.%3C%2FP%3E%3CP%3EI%20have%20then%20turned%20on%20sheet%20protection.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20I%20want%20to%20happen%3A%3C%2FP%3E%3CP%3E-%20a%20user%20can%20add%20lines%2C%20delete%20lines%2C%20re-sort%20lines%20with%20the%20calculated%20column%20being%20locked%20and%20automatically%20added%20when%20new%20lines%20are%20added.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhat%20happens%3A%3C%2FP%3E%3CP%3E-%20i%20get%20an%20error%20saying%20the%20sheet%20needs%20to%20be%20unlocked.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIt%20is%20currently%20protected%20so%20if%20you%20try%20to%20add%20a%20row%20you%20will%20see%20the%20error.%20If%20you%20unprotect%20the%20sheet%20(no%20password)%20you%20can%20add%20and%20delete%20rows%20fine%20but%20can%20edit%20the%20annual%20total%20which%20is%20what%20i%20need%20to%20avoid.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20help%20appreciated.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3299429%22%20slang%3D%22en-US%22%3ERe%3A%20How%20can%20i%20protect%20a%20calculated%20column%20in%20a%20table%20from%20being%20edited%20but%20allowing%20users%20to%20add%20row%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3299429%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1377080%22%20target%3D%22_blank%22%3E%40TonyCrabb%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20keep%20in%20mind%20that%20no%20one%20can%20see%20what%20you%20see%3C%2FP%3E%3CP%3EIn%20this%20link%20you%20will%20find%20some%20more%20information%20about%20it%3A%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fexcel%2Fwelcome-to-your-excel-discussion-space%2Fm-p%2F2204395%22%20target%3D%22_blank%22%3EWelcome%20to%20your%20Excel%20discussion%20space!%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20your%20understanding%20and%20patience%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fexcel-blog%2Fmeet-niko-chatzoudis-excel-forum-contributor%2Fba-p%2F2941385%22%20target%3D%22_blank%22%3ENikolinoDE%3C%2FA%3E%3C%2FP%3E%3CP%3EI%20know%20I%20don't%20know%20anything%20(Socrates)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3312940%22%20slang%3D%22en-US%22%3ERe%3A%20How%20can%20i%20protect%20a%20calculated%20column%20in%20a%20table%20from%20being%20edited%20but%20allowing%20users%20to%20add%20row%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3312940%22%20slang%3D%22en-US%22%3EThanks%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F127945%22%20target%3D%22_blank%22%3E%40Hans%20Vogelaar%3C%2FA%3E%20i%20have%20set%20this%20up%20and%20added%20a%20button%20to%20activate%20and%20it%20does%20now%20add%20a%20row%20and%20then%20relock%20which%20is%20great!%20But%20it%20raises%20a%20few%20new%20questions%3A%3CBR%20%2F%3E1.%20the%20row%20always%20adds%20at%20the%20bottom%20of%20the%20table.%20can%20it%20add%20based%20on%20the%20row%20the%20cursor%20is%20on%3F%3CBR%20%2F%3E2.%20in%20my%20example%2C%20i%20had%20enabled%20things%20like%20sort%20and%20filter%20etc%20on%20the%20protect%20options%20but%20the%20macro%20resets%20all%20of%20those%20so%20it%20doesnt%20allow%20me%20to%20filter%20after%20inserting%3CBR%20%2F%3E3.%20is%20there%20a%20way%20to%20link%20the%20macro%20to%20the%20standard%20row%20insert%20instead%20of%20me%20adding%20a%20new%20button%3F%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3313352%22%20slang%3D%22en-US%22%3ERe%3A%20How%20can%20i%20protect%20a%20calculated%20column%20in%20a%20table%20from%20being%20edited%20but%20allowing%20users%20to%20add%20row%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3313352%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1377080%22%20target%3D%22_blank%22%3E%40TonyCrabb%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThis%20version%20will%20try%20to%20insert%20a%20new%20row%20in%20the%20row%20of%20the%20active%20cell%2C%20so%20you%20need%20only%20one%20button%20to%20call%20the%20macro.%3C%2FP%3E%0A%3CP%3ECheck%20out%20the%20wsh.Protect%20part%20and%20change%20the%20True%2FFalse%20arguments%20as%20needed.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-visual-basic%22%3E%3CCODE%3ESub%20AddRow()%0A%20%20%20%20Dim%20wsh%20As%20Worksheet%0A%20%20%20%20Dim%20tbl%20As%20ListObject%0A%20%20%20%20Dim%20pwd%20As%20String%0A%20%20%20%20Dim%20pos%20As%20Long%0A%20%20%20%20Application.ScreenUpdating%20%3D%20False%0A%20%20%20%20pwd%20%3D%20%22secret%22%0A%20%20%20%20Set%20wsh%20%3D%20ActiveSheet%0A%20%20%20%20wsh.Unprotect%20Password%3A%3Dpwd%0A%20%20%20%20Set%20tbl%20%3D%20ActiveSheet.ListObjects(1)%0A%20%20%20%20pos%20%3D%20ActiveCell.Row%20-%20tbl.Range.Row%0A%20%20%20%20tbl.ListRows.Add%20Position%3A%3Dpos%2C%20AlwaysInsert%3A%3DFalse%0A%20%20%20%20wsh.Protect%20Password%3A%3Dpwd%2C%20DrawingObjects%3A%3DFalse%2C%20_%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Contents%3A%3DTrue%2C%20Scenarios%3A%3DFalse%2C%20_%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20AllowFormattingCells%3A%3DTrue%2C%20AllowFormattingColumns%3A%3DTrue%2C%20_%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20AllowFormattingRows%3A%3DTrue%2C%20AllowInsertingColumns%3A%3DTrue%2C%20_%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20AllowInsertingRows%3A%3DTrue%2C%20AllowInsertingHyperlinks%3A%3DTrue%2C%20_%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20AllowDeletingColumns%3A%3DTrue%2C%20AllowDeletingRows%3A%3DTrue%2C%20_%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20AllowSorting%3A%3DTrue%2C%20AllowFiltering%3A%3DTrue%2C%20_%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20AllowUsingPivotTables%3A%3DTrue%0A%20%20%20%20Application.ScreenUpdating%20%3D%20True%0AEnd%20Sub%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3313746%22%20slang%3D%22en-US%22%3ERe%3A%20How%20can%20i%20protect%20a%20calculated%20column%20in%20a%20table%20from%20being%20edited%20but%20allowing%20users%20to%20add%20row%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3313746%22%20slang%3D%22en-US%22%3EThanks%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F127945%22%20target%3D%22_blank%22%3E%40Hans%20Vogelaar%3C%2FA%3E.%20This%20is%20great%20and%20so%20powerful%20but%20we%20are%20still%20having%20to%20re-create%20a%20massive%20amount%20of%20features%20just%20to%20protect%20a%20calculated%20column%20(eg%20i%20need%20to%20solve%20this%20for%20deleting%2C%20sorting%20etc%20as%20well).%3CBR%20%2F%3E%3CBR%20%2F%3EComing%20at%20this%20a%20slightly%20different%20way%2C%20is%20it%20possible%20to%20fire%20a%20macro%20when%20i%20enter%20a%20column%20so%20that%20it%20automatically%20jumps%20over%20that%20column%3F%20so%20in%20my%20calculated%20column%20example%2C%20could%20i%20leave%20the%20sheet%20unprotected%20but%20if%20i%20try%20to%20enter%20the%20calculated%20columm%20via%20a%20click%20or%20a%20tab%20or%20an%20arrow%20(%20eg%20some%20sort%20of%20on%20Select)%20could%20it%20automatically%20move%20me%20to%20the%20next%20or%20previous%20column%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3313821%22%20slang%3D%22en-US%22%3ERe%3A%20How%20can%20i%20protect%20a%20calculated%20column%20in%20a%20table%20from%20being%20edited%20but%20allowing%20users%20to%20add%20row%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3313821%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1377080%22%20target%3D%22_blank%22%3E%40TonyCrabb%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThat%20is%20too%20difficult%20(we%20don't%20know%20how%20the%20user%20arrived%20there)%2C%20but%20you%20can%20do%20something%20like%20this%20if%20you%20really%20want%20to%20irritate%20your%20users%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3ERight-click%20the%20sheet%20tab.%3C%2FLI%3E%0A%3CLI%3ESelect%20View%20Code%20from%20the%20context%20menu.%3C%2FLI%3E%0A%3CLI%3ECopy%20the%20code%20listed%20below%20into%20the%20worksheet%20module.%3C%2FLI%3E%0A%3CLI%3EChange%20Range(%22F%3AF%22)%20to%20the%20column%20you%20want%20to%20make%20inaccessible.%3C%2FLI%3E%0A%3CLI%3EIf%20you%20ever%20want%20to%20edit%20the%20column%2C%20type%20the%20following%20in%20the%20Immediate%20window%20of%20the%20Visual%20Basic%20Editor%20and%20press%20Enter%3A%3CBR%20%2F%3E%3CBR%20%2F%3EApplication.EnableEvents%20%3D%20False%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLI%3E%0A%3CLI%3EWhen%20you're%20done%2C%20do%20the%20same%20but%20with%3CBR%20%2F%3E%3CBR%20%2F%3EApplication.EnableEvents%20%3D%20False%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLI%3E%0A%3CLI%3EDon't%20forget%20this%2C%20otherwise%20the%20worksheet%20won't%20react%20to%20events%20anymore.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-visual-basic%22%3E%3CCODE%3EPrivate%20Sub%20Worksheet_SelectionChange(ByVal%20Target%20As%20Range)%0A%20%20%20%20If%20Not%20Intersect(Range(%22F%3AF%22)%2C%20Target)%20Is%20Nothing%20Then%0A%20%20%20%20%20%20%20%20Application.EnableEvents%20%3D%20False%0A%20%20%20%20%20%20%20%20Beep%0A%20%20%20%20%20%20%20%20Range(%22A1%22).Select%0A%20%20%20%20%20%20%20%20Application.EnableEvents%20%3D%20True%0A%20%20%20%20End%20If%0AEnd%20Sub%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3313939%22%20slang%3D%22en-US%22%3ERe%3A%20How%20can%20i%20protect%20a%20calculated%20column%20in%20a%20table%20from%20being%20edited%20but%20allowing%20users%20to%20add%20row%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3313939%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1377080%22%20target%3D%22_blank%22%3E%40TonyCrabb%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20may%20be%20a%20silly%20solution%2C%20but%20I%20wondered%20if--unless%20you're%20worried%20that%20people%20could%20intentionally%20or%20maliciously%20override%20your%20calculations--you%20couldn't%20just%20move%20the%20calculating%20column%20off%20to%20the%20right%20and%20hide%20it%20to%20prevent%20inadvertent%20entries.%20(Or%2C%20to%20be%20more%20extreme%2C%20put%20the%20calculations%20on%20a%20separate%20sheet%2C%20and%20hide%20the%20sheet).%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3313965%22%20slang%3D%22en-US%22%3ERe%3A%20How%20can%20i%20protect%20a%20calculated%20column%20in%20a%20table%20from%20being%20edited%20but%20allowing%20users%20to%20add%20row%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3313965%22%20slang%3D%22en-US%22%3EThanks%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F127945%22%20target%3D%22_blank%22%3E%40Hans%20Vogelaar%3C%2FA%3E.%20instead%20of%20the%20beep%20and%20going%20to%20A1%2C%20can%20you%20find%20current%20row%20and%20just%20move%20the%20cursor%20automatically%20to%20Col%20E%20on%20current%20row%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3314214%22%20slang%3D%22en-US%22%3ERe%3A%20How%20can%20i%20protect%20a%20calculated%20column%20in%20a%20table%20from%20being%20edited%20but%20allowing%20users%20to%20add%20row%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3314214%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1377080%22%20target%3D%22_blank%22%3E%40TonyCrabb%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20remove%20the%20Beep%20line%20and%20change%20Range(%22A1%22).Select%20to%20Range(%22E%22%20%26amp%3B%20Target.Row).Select%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3314603%22%20slang%3D%22en-US%22%3ERe%3A%20How%20can%20i%20protect%20a%20calculated%20column%20in%20a%20table%20from%20being%20edited%20but%20allowing%20users%20to%20add%20row%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3314603%22%20slang%3D%22en-US%22%3EThanks%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F127945%22%20target%3D%22_blank%22%3E%40Hans%20Vogelaar%3C%2FA%3E%20-%20you%20have%20been%20very%20helpful.%20I%20need%20to%20sleep%20on%20this%20one%20and%20have%20a%20think%20about%20where%20to%20go%20next.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-3314612%22%20slang%3D%22en-US%22%3ERe%3A%20How%20can%20i%20protect%20a%20calculated%20column%20in%20a%20table%20from%20being%20edited%20but%20allowing%20users%20to%20add%20row%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3314612%22%20slang%3D%22en-US%22%3EThanks%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F425987%22%20target%3D%22_blank%22%3E%40mathetes%3C%2FA%3E%20but%20i%20need%20to%20keep%20the%20calculated%20column%20visible%20for%20the%20users.%3C%2FLINGO-BODY%3E
Occasional Contributor

Hi, I have a simple example of a data entry form (on an excel table) with 4 columns for entry of quarterly financial data. i have a 5th column that adds up the 4 quarters into an annual cost per line. this is a calculated column in the table so adding rows automatically adds the calculation to sum up the annual costs.

 

I need to be able to lock the annual column to stop editing while allowing new rows to be added. This is because i need to distribute the entry across a number of users and need to ensure they dont edit calculated columns.

 

When i protect the column and lock the sheet, i get an error adding rows saying i need to unlock.

 

Any advice on what im doing wrong please?

18 Replies

@TonyCrabb 

Please keep in mind that no one can see what you see

In this link you will find some more information about it:

Welcome to your Excel discussion space!

 

Thank you for your understanding and patience

 

NikolinoDE

I know I don't know anything (Socrates)

Some additional context....
Windows 10 PC
MIcrosoft 365 Apps for Enterprise
Excel Version: Excel for Microsoft 365 MSO (16.0.13127.21886) 32-bit

In the attached file, i have a simple table with one calculated column.

I have unprotected the date entry columns (title, Q1-Q4 and left the annual caculated column locked.

I have then turned on sheet protection.

 

What I want to happen:

- a user can add lines, delete lines, re-sort lines with the calculated column being locked and automatically added when new lines are added.

 

What happens:

- i get an error saying the sheet needs to be unlocked.

 

It is currently protected so if you try to add a row you will see the error. If you unprotect the sheet (no password) you can add and delete rows fine but can edit the annual total which is what i need to avoid.

 

Any help appreciated.

@TonyCrabb 

Here is a solution with data validation.

This presented procedure protects the cells from accidentally overwriting the cells.

However, the locked cell can still be deleted with the Delete key.

Protected cells can also be overwritten using the copy and paste function.

The function presented does not represent particularly good protection,

but it is sufficient in practice in many cases.

Otherwise it would have to be done with VBA, but it takes time,

which I unfortunately don't have available.

 

Hope I was able to help you

 

NikolinoDE

I know I don't know anything (Socrates)

I am looking for something more robust than that.

Is there really no inbuilt way in Excel to be able to instert a row into a table while protecting a calculated column? That seems such a basic need?
I don't know of any other approach without VBA, but this doesn't have to be the case, it may be, I don't know, that there could be other ways, but these are beyond my knowledge.

@TonyCrabb 

For example:

Sub AddRow()
    Dim strPassword As String
    strPassword = "secret"
    Application.ScreenUpdating = False
    ActiveSheet.Unprotect Password:=strPassword
    ActiveSheet.ListObjects(1).ListRows.Add AlwaysInsert:=False
    ActiveSheet.Protect Password:=strPassword
    Application.ScreenUpdating = True
End Sub
Thanks @Hans Vogelaar i have set this up and added a button to activate and it does now add a row and then relock which is great! But it raises a few new questions:
1. the row always adds at the bottom of the table. can it add based on the row the cursor is on?
2. in my example, i had enabled things like sort and filter etc on the protect options but the macro resets all of those so it doesnt allow me to filter after inserting
3. is there a way to link the macro to the standard row insert instead of me adding a new button?

@TonyCrabb 

This version will try to insert a new row in the row of the active cell, so you need only one button to call the macro.

Check out the wsh.Protect part and change the True/False arguments as needed.

 

Sub AddRow()
    Dim wsh As Worksheet
    Dim tbl As ListObject
    Dim pwd As String
    Dim pos As Long
    Application.ScreenUpdating = False
    pwd = "secret"
    Set wsh = ActiveSheet
    wsh.Unprotect Password:=pwd
    Set tbl = ActiveSheet.ListObjects(1)
    pos = ActiveCell.Row - tbl.Range.Row
    tbl.ListRows.Add Position:=pos, AlwaysInsert:=False
    wsh.Protect Password:=pwd, DrawingObjects:=False, _
                Contents:=True, Scenarios:=False, _
                AllowFormattingCells:=True, AllowFormattingColumns:=True, _
                AllowFormattingRows:=True, AllowInsertingColumns:=True, _
                AllowInsertingRows:=True, AllowInsertingHyperlinks:=True, _
                AllowDeletingColumns:=True, AllowDeletingRows:=True, _
                AllowSorting:=True, AllowFiltering:=True, _
                AllowUsingPivotTables:=True
    Application.ScreenUpdating = True
End Sub
Thanks @Hans Vogelaar. This is great and so powerful but we are still having to re-create a massive amount of features just to protect a calculated column (eg i need to solve this for deleting, sorting etc as well).

Coming at this a slightly different way, is it possible to fire a macro when i enter a column so that it automatically jumps over that column? so in my calculated column example, could i leave the sheet unprotected but if i try to enter the calculated columm via a click or a tab or an arrow ( eg some sort of on Select) could it automatically move me to the next or previous column?

@TonyCrabb 

That is too difficult (we don't know how the user arrived there), but you can do something like this if you really want to irritate your users:

  • Right-click the sheet tab.
  • Select View Code from the context menu.
  • Copy the code listed below into the worksheet module.
  • Change Range("F:F") to the column you want to make inaccessible.
  • If you ever want to edit the column, type the following in the Immediate window of the Visual Basic Editor and press Enter:

    Application.EnableEvents = False


  • When you're done, do the same but with

    Application.EnableEvents = True


  • Don't forget this, otherwise the worksheet won't react to events anymore.

 

 

 

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Not Intersect(Range("F:F"), Target) Is Nothing Then
        Application.EnableEvents = False
        Beep
        Range("A1").Select
        Application.EnableEvents = True
    End If
End Sub

 

 

@TonyCrabb 

 

This may be a silly solution, but I wondered if--unless you're worried that people could intentionally or maliciously override your calculations--you couldn't just move the calculating column off to the right and hide it to prevent inadvertent entries. (Or, to be more extreme, put the calculations on a separate sheet, and hide the sheet).

Thanks @Hans Vogelaar. instead of the beep and going to A1, can you find current row and just move the cursor automatically to Col E on current row?

@TonyCrabb 

You can remove the Beep line and change Range("A1").Select to Range("E" & Target.Row).Select

Thanks @Hans Vogelaar - you have been very helpful. I need to sleep on this one and have a think about where to go next.
Thanks @mathetes but i need to keep the calculated column visible for the users.