title: How to Lock Cell based on the value of the another cell and perform data validation
body: <p>I am very new to VBA code. Now I was assigned to make a task that validate the data in an excel sheets. </p>
  
  <p>For Example in my <strong>Column A</strong>, I have a drop down menu that enable the user to make a selection between "Yes" or "No" only. </p>
  
  <ul>
  <li><p>If user selected "Yes", cells in Column B and Column C will be marked as Mandatory and cannot be blank. I want to put a validation error on this. </p>
  
  <pre><code>**Example 1: If A1 and A30 == YES**
  </code></pre>
  
  <ul>
  <li><p>B1 and C1, B30 and C30 are mandatory</p></li>
  <li><p>Will fill a color to the mandatory cells and remove the fill color when     the cells have value already</p></li>
  <li><p>Throw a validation error when these cells are blank and if exceeds
  the number of characters required.</p>
  
  <p><strong>Example 2: If A99 == NO</strong></p></li>
  <li><p>B99 will be locked and the user will not be allowed to enter a data
  on this cell. Possible that we can add a cell value as "NA" to avoid
  confusion</p></li>
  </ul></li>
  </ul>
  
  <p>I was able to capture this using the data validation and conditional formatting. However, I cannot perform the locked functionality since as per research, I need a VBA code for this one.</p>