#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 54
Default Protect a formula

Hi all,
I have a protected sheet that only a specific user can open with password
and edit it. One of the cells has a formula and i want to restrict the user
from deleting the specified cell. Any suggestions?
Thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,327
Default Protect a formula

If you are allowing the user to unlock the sheet, then I'd create a macro,
called from the worksheet_change event, that reinstates the formula if it
gets altered or removed.

HTH. Best wishes Harald

"Lp12" skrev i melding
...
Hi all,
I have a protected sheet that only a specific user can open with password
and edit it. One of the cells has a formula and i want to restrict the

user
from deleting the specified cell. Any suggestions?
Thanks in advance



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 54
Default Protect a formula

Hi Harald,
Thanks a lot for replying. I've tried to wriet a code to do that but got
messy. Might you have a sample code so i could practice?
Thanks a lot.

"Harald Staff" wrote:

If you are allowing the user to unlock the sheet, then I'd create a macro,
called from the worksheet_change event, that reinstates the formula if it
gets altered or removed.

HTH. Best wishes Harald

"Lp12" skrev i melding
...
Hi all,
I have a protected sheet that only a specific user can open with password
and edit it. One of the cells has a formula and i want to restrict the

user
from deleting the specified cell. Any suggestions?
Thanks in advance




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,327
Default Protect a formula

Sure. Try

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cel As Range
If Intersect(Target, Me.Range("B1")) Is Nothing Then Exit Sub
If Me.Range("B1").FormulaR1C1 < _
"=IF(R2C1<0,R1C1/R2C1,0)" Then
Application.EnableEvents = False
Me.Range("B1").FormulaR1C1 = _
"=IF(R2C1<0,R1C1/R2C1,0)"
Application.EnableEvents = True
End If
End Sub

It secures the formula in B1. This goes in the worksheet module (rightclick
sheet tab, "view code" to access). Note its behavior when you insert/delete
rows and columns.

HTH. best wishes Harald

"Lp12" skrev i melding
...
Hi Harald,
Thanks a lot for replying. I've tried to wriet a code to do that but got
messy. Might you have a sample code so i could practice?
Thanks a lot.

"Harald Staff" wrote:

If you are allowing the user to unlock the sheet, then I'd create a

macro,
called from the worksheet_change event, that reinstates the formula if

it
gets altered or removed.

HTH. Best wishes Harald

"Lp12" skrev i melding
...
Hi all,
I have a protected sheet that only a specific user can open with

password
and edit it. One of the cells has a formula and i want to restrict the

user
from deleting the specified cell. Any suggestions?
Thanks in advance






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Protect formula joen Excel Discussion (Misc queries) 2 June 25th 06 04:11 PM
How do you protect the formula? Steverino New Users to Excel 1 January 26th 06 05:22 AM
Protect formatting & formula Scott Excel Discussion (Misc queries) 1 December 18th 05 11:40 PM
protect formula in cell and still allow data deletion Shawna Excel Discussion (Misc queries) 1 November 4th 05 03:16 PM
how do I protect a formula in an excel speadsheet greg Excel Worksheet Functions 1 January 31st 05 11:29 PM


All times are GMT +1. The time now is 02:46 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"