title: How to check if a cell is empty using VBA
body: <p>I'm trying to make a form on excel so that when people don't fill in certain cells, they will get pop-up error messages. So far, I made this code:</p>
  
  <pre><code>If Len(I8) = 0 Then
  MsgBox "Please enter Required Date", vbExclamation
  Exit Sub
  ElseIf Len(D11) = 0 Then
  MsgBox "Please enter your name", vbExclamation
  Exit Sub
  ElseIf Len(H11) = 0 Then
  MsgBox "Please enter Work Phone", vbExclamation
  Exit Sub
  ElseIf Len(L11) = 0 Then
  MsgBox "Please enter Home Phone", vbExclamation
  Exit Sub
  End If
  MsgBox "All mandatory fields have been entered", vbExclamation
  End Sub
  </code></pre>
  
  <p>Which seemed to work, but when I added text to the cell <code>I8</code>, the "Please enter Required Date" msgbox popped up anyways.</p>
  
  <p>I've also tried using <code>Count(I8) = 0</code>, and <code>IfEmpty(I8) = True</code>, but neither were recognized properly in vba.</p>
  
  <p>Also, if I want a pop-up message to appear when a cell is not filled out if they picked "YES" from a drop-down list, what would the function be? So far I've written</p>
  
  <pre><code>ElseIf Range("D28") = "P16" And Len(Range("M30")) = 0 Then
  MsgBox "Please Select whether this file is classified as confidential", vbExclamation
  Exit Sub
  </code></pre>
  
  <p>But I need a defined function and I'm not sure what to pick. Is there a longer way to do it to ensure that both cells are filled out if they pick yes in the first cell?</p>