Protecting and Hiding Formula
Hi Jade,
there are at least two possibilities:
1) If the formulas you want to protect are used for providing data
which will be used by other formulas (i.e. that the result of the
formula is not needed to be visible) then simply do the following: in
the standard menu select Format - Cell - Number - User defined and type
in ";;;". Then the cell appears to be empty. Only if you select it, the
formula is visible.
2) The formulas can be protected by running the following macro. It
checks all cells and if they do not contain a formula they are
unprotected. In the other case this cell is protected. Then the whole
sheet is protected. Effect: all cells can be modified but those with a
formula.
Sub ProtectFormula()
Dim rngActiveCell As Range
Application.ScreenUpdating = False
ActiveSheet.Unprotect
For Each rngActiveCell In ActiveSheet.UsedRange
If Not rngActiveCell.HasFormula Then
rngActiveCell.Locked = False
ElseIf rngActiveCell.HasFormula = True Then
rngActiveCell.Locked = True
End If
Next
ActiveSheet.Protect
Application.ScreenUpdating = True
End Sub
Of course, you can combine both and extend the macro which makes the
cells containing formulae appearing blank.
Hope this was of any help for you
Udo
|