title: How to set dependency in VBA in excel using if-then-else?
body: <p>I'm fairly new to excel and i'm trying to create a macro to automate my process.</p>
  
  <p>So what i'm trying to do with my macro is to highlight each entry in column C depending upon the entry in column A i.e. if there's a name in column A and there's no phone number corresponding to that name in Cell C, then it should be highlighted,but what my macro is doing is that it is highlighting all the blank rows in column C irrespective of an entry in column A. So if you could suggest me a formula or an if-then-else condition based on this, it'll be a great help thanks....here's my code snippet:</p>
  
  <pre><code>Selection.FormatConditions(1).StopIfTrue = False
  Columns("C:C").Select
  'Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
     ' "=LEN(TRIM(C1))=0"
  If (Len(A4 &lt;&gt; 0) And Len(C4 = 0)) Then
  Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
  With Selection.FormatConditions(1).Interior
      .PatternColorIndex = xlAutomatic
   .color = 5296274
      .TintAndShade = 0
  
  End With
  Selection.FormatConditions(1).StopIfTrue = False
  Range("D10").Select
  End If
  </code></pre>
  
  <p>What i did in my IF condition was that i was trying to implement it for 1 row first, but it wasn't working either(I need to implement this condition on all the entries being made in column C depending upon the name enterd in column A)..and yeah there's a formula above that is doing the highlighting of the entire column but I commented it and was experimenting with if-then-else..so if you can provide me with an alternate formula for this thing, it'll be fine too</p>