The code will work for every cell on the sheet. The Target variable will refer to whatever cell(s) have been changed. It is dynamic.
If you want to be able to enter into any cell to begin with, you should make sure all of the cells are unlocked. That way when the sheet is protected if you make a change, only the cells you changed will be locked and the others should still be available to edit.
So, do this:
- Unprotect the sheet (if needed)
- Ctrl+A (selects all cells on the sheet)
- Format->Cells->Protection tab
- Uncheck the box next to "Locked."
- Click OK
All cells on that sheet should now be unprotected. When you edit a cell, the macro should kick in and then lock only those cells you changed, and then protect the sheet so that those cells can no longer be changed.
Edit: There is a difference in the code I posted and the code Brian posted, though. My code will work only on the active sheet (the one you make the changes on). Brian's code will only unprotect a sheet named "Sheet1"--it will not matter whether that is the active sheet or not.