Hi, I need to lock a cell (F21) if J26 is less than 100. Can't work out how in conditional formatting. Is there a different way?
This is what I need to do:
F21=(IF,J26<100,Locked,Unlocked)
Hi, I need to lock a cell (F21) if J26 is less than 100. Can't work out how in conditional formatting. Is there a different way?
This is what I need to do:
F21=(IF,J26<100,Locked,Unlocked)
Last edited by beesus311; 02-23-2008 at 08:32 AM.
Copy the code below to the VBA object of the worksheet these cells are in :
Private Sub Worksheet_Change(ByVal Target As Range)
Erik![]()
If Not Intersect(Target, Range("K26")) Is Nothing Then If Target.Value > 100 Then ActiveSheet.Unprotect Range("F21").Locked = True ActiveSheet.Protect Else ActiveSheet.Unprotect Range("F21").Locked = False ActiveSheet.Protect End If End If End Sub
I'm not that familiar with how to do that. Could you tell me how that works? Sounds more advanced than I have so far learned.
You could put a custom Validation on F21 of =(99<J26)
_
...How to Cross-post politely...
..Wrap code by selecting the code and clicking the # or read this. Thank you.
and how would I do that? I'm not sure what you mean.
I've tried that and it doesn't appear to allow me to lock and unlock cells.
For pre-2007:
Select Cell F21
Go to the Data Menu and choose Validation
Perhaps uncheck the Ignore Blanks
On the Setting tab, choose Custom from the Allow dropdown.
In the Formula box, type "=(99<J26)" (no quotes).
If you want the user warned, rather than forbidden, the Error Message tab has that option.
Click OK
People will be unable to enter anything in F21 unless 99 < J26.
It acts a little different than Locking a cell and Protecting a sheet, but prevents inadvertant data entry
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks