You may want to let users change cells containg data without providing them access to change formulas. You can keep cells containing formulas under lock and key without having to protect your entire sheet or workbook.
When we create a spreadsheet, most of us need to use formulas of some sort. Sometimes, however, you might not want other users to tamper/delete/overtype any formulas you included on your spreadsheet. The easiest and most common way of barring people from playing with your formulas is to protect your worksheet. However, protecting your worksheet doesn't just prevent users from tampering with your formulas, it also stops users from entering anything at all. Sometimes you do not want to go this far.
By default, all cells on a worksheet are locked; however, this has no effect unless worksheet protection has been applied. Here is a very easy way to apply worksheet protection so that only formula cells are locked and protected.
Select all cells on your worksheet,
either by pressing Ctrl/
Now
select any single cell, select Edit
Select
Formulas from the Go To Special dialog and, if needed, limit the
formulas to the subtypes underneath. Click OK. With only the formula
cells selected, select Format
The preceding method certainly saves a lot of time and eliminates possible errors locating formulas so that you can protect them. Unfortunately, it can also prevent users from using certain features, such as sorting, formatting changes, aligning text, and many others you might not be concerned with, even when in an unlocked cell. You can overcome this problem in two ways.
The first approach doesn't use worksheet protection at all, and uses data validation instead.
|
To
see what we mean, select any single cell, select Edit
With only the Formula cells selected,
select the Data
This method will prevent a user from accidentally overtyping into any formula cells although, as stressed in the earlier warning, it is not a fully secure method and should be used only for accidental overtyping, etc. However, the big advantage to using this method is that all of Excel's features are still usable on the worksheet.
The last method also will enable you to use all of Excel's features, but only when you are in a cell that is not locked. To start, ensure that only the cells you want protected are locked and that all other cells are unlocked. Right-click the Sheet Name tab, select View Code from the pop-up menu, and enter the following code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Locked = True Then Me.Protect Password:="Secret" Else Me.Unprotect Password:="Secret" End If End Sub
If no password is used, omit Password:="Secret".
If a password is used, change the word Secret to
your password. Press Alt/
|