View Single Post
  #5   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
Harlan Grove[_2_] Harlan Grove[_2_] is offline
external usenet poster
 
Posts: 1,231
Default Prevent formula entry

"NickHK" wrote...
Nothing built-in, but you can check either at the WS or WB level:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cell As Range

Application.EnableEvents = False
For Each Cell In Target.Cells
If Cell.HasFormula = True Then
Cell.Value = ""
MsgBox "No formulae allowed"
End If
Next
Application.EnableEvents = True

End Sub


Note that this can be defeated easily by disabling macros.

Personally, I can't think of any good reason to prevent users from making
any valid entries, constants or formulas. It won't prevent users from trying
to find values in hidden worksheets/rows/columns. All they'd need to do is
open a new workbook and enter formulas with external references into the
'protected' workbook.