View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Confirm formula change

Hi,

I was aware of sheet protection but my formulas are kinda of
scattered.

..
This should not present any problem, all of your formulas can be picked up
using the SpecialCells method.

The following routine uses sheet protection to prevent editing of your
formula cells, all other cells can be edited as usual

Sub LockFormulae()
Dim rng As Range
On Error Resume Next
Set rng = ActiveSheet.Cells.SpecialCells(xlFormulas)
On Error GoTo 0
If Not rng Is Nothing Then
ActiveSheet.Unprotect
ActiveSheet.Cells.Locked = False
rng.Locked = True
ActiveSheet.Protect
Else
'No formulas to protect!
End If

End Sub


---
Regards,
Norman



wrote in message
...
Ok, thanks. I was just wondering if there was an easy
way to keep my formulas for being accidentally
edited/overwritten by a non-savvy user. Oh well. I was
aware of sheet protection but my formulas are kinda of
scattered. I had also experimented w/ Application.Undo
and the Worksheet_Change event but didn't have any luck.
Thanks anyway.


-----Original Message-----
Is there a way if when a user changes a cell that
contains a formula, I can pop up a msgbox to ask if they
really want to do that and give them yes/no or

ok/cancel
options? Thanks.
.