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![]()
Please Login or Register to view this content.
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.
What does this mean?
Private Sub Worksheet_Change(ByVal Target As Range)
I've entered the VB code - But it doesn't seem to be working.
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
I need to stop them selecting the cell at all. I'm on 2007.
OK. I'v got that working, but would to prefer to be able to have the cell locked. Do you understand the VB way as outlined by WintE?
Could you explain exactly how I would go about making that work?
Hi,
Unfortunately I made a mistake in the code, Range("K26") should be ("J26") and '> 100' should be '> 99'.
The way the code works is as follows :
- In the cell-preferences you sign the protection of cell J26 and F21 unblocked
- Protect the worksheet.
Now you're only able to enter data in cell J26 and F21.
Once you enter a value > 99 cell F21 will be protected.
Erik
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks