Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Gyges
 
Posts: n/a
Default Conditional Cell Protection

In Excel, is there anyway to protect a cell only if it meets a certain
condition?

  #2   Report Post  
Simon Shaw
 
Posts: n/a
Default

This can be achieved through a macro, however, you would need to store the
password in the macro to unlock the sheet in order to make the changes -
assuming you have locked the sheet.

You would need to write the code in the VBA object for the sheet in
question, then using the macro:

Private Sub Worksheet_Change(ByVal Target As Range)

'find if condition is met for the cells in question then lock the cell
' assuming the cells in question are in B1:B5

Activesheet.Unprotect Password:="myPassword"

With ActiveSheet.Range("B1:B5")
For i = 1 to .Rows.Count
If .Cells(i, 1).Value 10 Then
.Locked = True
End If
Next I
End With

Activesheet.Protect Password:="myPassword"

End Sub



"Gyges" wrote:

In Excel, is there anyway to protect a cell only if it meets a certain
condition?


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
Conditional formating - cell protection Bdavis Excel Discussion (Misc queries) 0 February 11th 05 09:15 PM
Conditional formatting row if cell value in certain column is even Hyland Hunt Excel Worksheet Functions 1 February 2nd 05 08:21 PM
Excel: how to formulate conditional cell references centraloffice Excel Worksheet Functions 1 December 10th 04 08:57 PM
conditional formatting blank cell TREK5200 Excel Discussion (Misc queries) 1 December 6th 04 02:23 AM
GET.CELL Biff Excel Worksheet Functions 2 November 24th 04 07:16 PM


All times are GMT +1. The time now is 08:53 PM.

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

About Us

"It's about Microsoft Excel"