View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson[_3_] Jim Thomlinson[_3_] is offline
external usenet poster
 
Posts: 983
Default HasFormula protect cell

One more thing that I forgot to mention. Make sure all of the cells you want
the user to be able to modify are unlocked. Otherwise if a user enters a
fromula into a cell that is locked, they will not be able to modify it later
on...

Jim Thomlinson


"SIGE" wrote:

Hello wizards,

Below sub works and does not work ...!!!
I mean: clicking on a cell that has a formula will "protect" the sheet
.... as you can unprotect the sheet. (ToolsProtectionUnprotect)
**But** does actually NOT protect at all as I can just overwrite the
formula in the cell!

Just try and see what I mean...

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Target.HasFormula = True Then
Me.Protect Password:=""
Else
Me.Unprotect Password:=""
End If
End Sub

Cheers Sige