A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Cell lock



 
 
Thread Tools Display Modes
  #1  
Old April 18th, 2005, 10:17 AM
Adam
external usenet poster
 
Posts: n/a
Default Cell lock

Is it possible to change the characteristics of a cell based on content of
another cell.
My problem is:
If c2=0 then e10 should be locked
if c2=1 then e10 should be unlocked.

I have conditional formatting on this cell e10 which is depending on the
content of c2, ie.
e10 = no fill = locked
e10 = yellow fill = unlocked.

If possible I would like to use the latter as condition.
Thanks
  #2  
Old April 18th, 2005, 10:45 AM
Fadi Chalouhi
external usenet poster
 
Posts: n/a
Default

Hi Adam,

here's the code:

Private Sub Worksheet_Change(ByVal Target As Range)
If Range("C2").Value = 0 Then
ActiveSheet.Unprotect
Range("E10").Locked = True
Range("E10").Interior.ColorIndex = xlNone
ActiveSheet.Protect
End If
If Range("C2").Value = 1 Then
ActiveSheet.Unprotect
Range("E10").Locked = False
Range("E10").Interior.ColorIndex = 6

ActiveSheet.Protect
End If
End Sub

Obviously, cell C2 is unprotected.
you might also want to add some passwords to the Protect/Unprotect
code.

HTH

Fadi
www.chalouhis.com/XLBLOG

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I lock an image into a cell and be able to sort? Ellen General Discussion 3 October 19th, 2004 08:44 PM
IF E3 & E10 = TRUE set this cell to "Yes", else set to "No" Timothy L Worksheet Functions 5 August 27th, 2004 02:28 AM
Newbie - Insert picture and lock to cell Chris Harden Charts and Charting 2 January 16th, 2004 04:11 PM
using cell contents in pathname Don Guillett Worksheet Functions 7 January 2nd, 2004 02:11 PM
How to lock one cell in formula? Worksheet Functions 2 December 26th, 2003 01:22 PM


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


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