From B2 to B11 if any one of the cell input a value of x, the other cells are not allowed to input any value.
Reset B2 to any other value, then other cells are allowed to enter input again
From B2 to B11 if any one of the cell input a value of x, the other cells are not allowed to input any value.
Reset B2 to any other value, then other cells are allowed to enter input again
Is it only B2 that will have the value of X? Are there values in the other cells of B2 to B11?
Pierre Leclerc
_______________________________________________________
If you like the help you got,
Click on the STAR "Add reputation" icon at the bottom.
If B2 is the ONLY cell you will be testing for, highlight B3:B11, use Data Validation, custom, and enter this
=B2<>"x"
1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
2. If your question is resolved, mark it SOLVED using the thread tools
3. Click on the star if you think someone helped you
Regards
Ford
Thanks for the input.
I think I do not post the right question.
I have 5 cells for examples, they are A2, B2, C2, D2 and E2. Only one of the cell can be selected. When one of the cell is selected and input a value of x, then the other cells are disable and cannot enter any value. To enable the other cells again, the cell with value has to be clear.
I know it is easier to use a dropdown but it is a scale to input.
Hi,
as far as I understood this should help:LockCells.xlsm
Regards
Please use [CODE]-TAGS
When your problem is solved mark the thread SOLVED
If an answer has helped you please click to give reputation
Read the FORUM RULES
Thank you.
It works, great code, but it is not exactly what I want because I did not make my question clear.
I just want to control 10 cells in the same row. If I enter a value to any one of the cell, the other cells int the same row are locked/disable to enter any value.
When I remove the value of the cell in the row I have inputted, all the cells in this row are unlocked/enabled again.
In this case, one can only enter a value in one of the 10 cells.
Hello dxcheung,
I am pretty sure that the attached WorkBook does what you want.
Also see the "Please consider" note at the bottom of this post.
Please consider:
Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .
Thanks for you help Winon.
The script is very useful but it is not exactly I want.
In the file you attached, when you put a value in L2, from A2 to J2 cells are locked and you can reset L2 for all cells to work again. It is different from what I want.
I need that when I input a value to any one from A2 to J2, except the cell I input a value, the other cells are locked. (for example if I input a value to A2, B2 to J2 are locked but after I clear A2 and I enter a value to B2, then A2, C2 to J2 are locked.
Hello dxcheung,
O.K. then.
How about this one?
[SOLVED]
Thank you very much Winon.
It is exactly what I needed - excellent way to use data validation.
I cannot add another star as I do not know how to spread the reputation around. I really appreciate you of the immediate help and the excellent answers.
Hi dxcheung,
You are welcome.
Glad I could help!
Please go to your first post of this Thread, click on Thread Tools, and mark it as solved.
Cheers!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks