I have defined a range of cells as a table in Excel 2010. I keep the sheet protected so that other users cannot mistakenly alter formulas. I've had to use a macro tied to a button to allow other users to add rows when the sheet is locked. However, I've noticed that when I add rows via the button, it auto-fills an incorrect formula in Column I. It is a formula that I typed in originally but later changed. I've also noticed that when I unlock the sheet and simply drag down the bottom-right corner of the table, it will put the correct formula in some rows and the incorrect formula in other rows, even alternating which rows have the correct formula.
Additional information you may need to answer:
- Table includes Columns A through I
- Current formula in Column I is:
=IF(G21=0," ",IF(G21="yes",I20+D21+H21,D21+(I20-F21))) - Old formula no longer used in Column I:
=IF(G24=0," ",IF(G24="yes",F20+H24,F20-F24)) - The Macro used is:
Sub AddRow()
ActiveSheet.Unprotect Password:="secret"
Range("A1").End(xlDown).ListObject.ListRows.Add AlwaysInsert:=False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, Password:="secret"
End Sub