Conditional cell lock

Anonymous
2025-04-14T16:51:43+00:00
If cell H3 = "no", selected from a drop down list, I want to prevent entry in cell I3. If "yes" then allow entry in I3. Also display message if I3 is entered and H3 = "no".
Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
Answer accepted by question author
HansV 460.5K Reputation points MVP Volunteer Moderator
2025-04-15T10:01:26+00:00

If you want to prevent users from viewing or editing the VBA code:

  • Activate the Visual Basic Editor (Alt+F11).
  • Select Tools > VBA Project Properties...
  • Activate the Protection tab.
  • Select the 'Lock project for viewing' check box.
  • Enter a password, and confirm it by entering it again in the box below.
  • Click OK.
  • Switch back to Excel.
  • Save the workbook.

Next time the workbook is opened, it will not be possible to view the VBA code unless you enter the correct password.

Was this answer helpful?

0 comments No comments
Answer accepted by question author
Anonymous
2025-04-14T20:55:51+00:00

Hi there

You can acheive that using Data Validation

Please try the following steps

  1. Select the cell (I3)
  2. Go to Data/Data Validation and select Custom
  3. Enter the formula =NOT(H3="No")
  4. And click OK

RESULT

If you type anything in cell I3, the error message will prompt and not allow the entry

Feel free to modify the default Error alert to your needs

When selecting Yes, you can enter the value in cell I3.

I hope this helps you

Regards

Jeovany

Was this answer helpful?

0 comments No comments

6 additional answers

Sort by: Oldest
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

  2. Anonymous
    2025-04-14T19:49:41+00:00

    Thank you

    I'm not familiar with VB, so I am not sure with your reference to range if you understood what I need.

    If H3 = no, then I3 is locked

    If H4 = yes, then I4 is unlocked

    etc.

    I only want one I cell locked, and not a range, if there is a no in a corresponding H cell. Will that do that?

    Thanks again

    Was this answer helpful?

    0 comments No comments
  3. HansV 460.5K Reputation points MVP Volunteer Moderator
    2025-04-14T19:58:41+00:00

    Yes - please follow the instructions in my first reply, then test.

    Was this answer helpful?

    0 comments No comments