Insert row and autofill locked cells - excel

I have a table in Excel 2007 where certain columns have formulas that are automatically filled downwards into their respective new cells when I insert a new row.
To prevent other users from modifying these columns, I locked them by protecting the sheet.
However, protecting the sheet prevents the formulae from copying down when inserting a new row with the following error:
The cell or chart that you are trying to change is protected and
therefore read-only. To modify a protected cell or chart, first remove
protection using the Unprotect Sheet (Review tab, Changes group). You
may be prompted for a password.
Is it possible to have both features together:
Insert a new row and automatically copy the formulas down
Protect the columns that contains formulas

Related

Password protect Excel sheet but allow editing

I have built an excel spreadsheet that pulls data from another sheet by various Vlookup. E.g if you type in a number in one cell it pulls back the corresponding Name, job, title etc from the data in the other sheet.
As this is to be used by others I wanted to Hide the formula so it’s not visible in the formula bar.
I unlocked all the cells, selected the cells with formula I wanted to hide, locked and hid those cells then protected the sheet. When testing I can enter data in the unlocked field and get results but I also have a reset macro button. When I reset the fields I am unable to enter data as the sheet is protected. Any help on what I might be doing wrong?

Is there a way to lock individual cells (not the entire Excel worksheet) to prevent formatting?

I'm preventing the user from formatting cells in a worksheet in a generated Excel file by executing this code:
XSSFWorkbook workbook = new XSSFWorkbook();
XSSFSheet sheet = workbook.createSheet("sheet1");
CTSheetProtection prot = sheet.getCTWorksheet().getSheetProtection();
prot.setFormatCells(true);
Is there a way to lock formatting for individual cells in a sheet as opposed to having to lock formatting for the entire sheet?
Likewise, is there a way to apply the other protections to individual cells?
For example, filtering and sorting - if someone tried to apply these operations on a group of cells that included a cell that was locked for that operation it would be disallowed.
In the Format Cells dialog box you can toggle cells locked or hidden. When you use "Protect Sheet" From the Review tab you can choose to protect the worksheet and the contents of locked cells, and choose what you want to allow the user to do to locked/unlocked cells. Password protect the sheet and users will not be able to remove the lock without your permission.
I'm assuming most of your cells are to be unlocked, so select all cells and set to unlocked and then lock the ones you want locked.
I am unsure of the code to do this through VBA, but it should be easy enough to find.
Logically, you would want to select all cells and then set the cells.format.protection.locked to false, and then select the ranges you want locked and set those to true. You could easily record a macro to find this code.
you should check this link, I have written a custom method to lock individual or range of cells in single or multi sheet excel file.
https://stackoverflow.com/a/63299413/6835092
for single cell locking just mention same range value. i.e a1:a1. this will lock only a1 cell.

Excel Protecting Rows and Columns but Allowing Cell Editing

I need to make a template where the rows and columns cannot be deleted but the cells can still be edited
Select all the cells in the sheet and unlock them
Take a cell that doesn't need to be edited (there must be at least one somewhere on the sheet) and lock it.
Activate sheet protection
You're done

VBA Excel - Protect column in a sheet based on a cell value

1 1 2
ACT ACT FCST
I have three columns, I would like to run a loop code to check values in 2nd row if it is ACT or FCST. If it is ACT, it will protect the whole column so it will not be updated.
You don't protect columns, you protect sheet. Cells are set as locked or not locked. Then if the sheet protection is activated, locked cells cannot be edited. So to unlock cells to make them editable, you have to unprotect the sheet, set cells as unlocked then protect the sheet.
Use the macro recorder to help you create code. When you develop code that has issue, post it for analysis.

Allow Copy/Paste and change font in an unlocked cell of a locked Excel sheet

I am creating a template in excel where I only want the user to be able to enter information in some of the cells. For that reason I have locked some cells and unlocked some others and I have also protect the corresponding sheet.
The user wants to be able to copy information from other excel sheet to one of the unlocked cells of the template and be able to change the format of the pasted text, being bold and underline options avaliable.
Is there any way to do that without having to unlock the sheet?
Thank you in advance for your time.
There are options when you apply protection to the sheet to still allow formatting.
There is no issue copying and pasting into a locked cell as far as I am aware.
There is an option when you apply protection to a worksheet in Excel to allow "Format Cells". Choose this if you want them to be able to apply formatting to the cell. Likewise, Format Rows and Format Columns if you want the user to be able top adjust the row height and column width.

Resources