I have an audit trail macro has a pop-up only when saving the workbook. What I have been trying to do is to add a lock cells to the macro for any new data. Any cells that require data entry are already unlocked and there are cells with formulas that are unlocked. I do not want to lock these unless something new is entered. What I am thinking is to use the information in columns A and B of the "Audit Trail" worksheet, which list the cell address and the worksheet, respectively, of all cells in which the data has been changed. These are cells that I need locked. There are three codes for the pop-up when saving, a worksheet code, a and a workbook code. The worksheet code is as follows:
The userform1 code is:
and the workbook code:
All of this works, but I want to lock the cells that have been changed. Does anybody know how to lock cells when the cell address and worksheet names are listed in 2 columns of a worksheet? The worksheet names will be needed not only for the cells that need to be locked, but to also unprotect and protect the worksheets before and after locking the cells. I have attached a copy of a workbook with 2 worksheets - some of my workbooks could have as many as 36 worksheets.
Bookmarks