title: How to change priority level on conditional formatting in VBA
body: <p>I am using VBA in excel 2013 and I have a question regarding setting the priority. I am trying to <em>change the priority</em> of my conditional formatting in a range. The <strong>last line</strong> before the End If is where I am having the issue. As of right now it is only inserting into the #1 position rather inserting into the #2 position. I have tried following the documentation on Microsoft, such as this page -></p>
  
  <p><a href="https://msdn.microsoft.com/en-us/library/office/microsoft.office.interop.excel.formatcondition.priority.aspx" rel="nofollow noreferrer">https://msdn.microsoft.com/en-us/library/office/microsoft.office.interop.excel.formatcondition.priority.aspx</a></p>
  
  <p>As well as other helpful pages that show examples-></p>
  
  <p><a href="https://blogs.office.com/en-us/2005/10/14/conditional-formatting-using-vba-some-examples/" rel="nofollow noreferrer">https://blogs.office.com/en-us/2005/10/14/conditional-formatting-using-vba-some-examples/</a></p>
  
  <p>But neither of these ultimately ended up working.</p>
  
  <pre><code>Range("F6:F9").Select
  If Selection.FormatConditions(2).Interior.TintAndShade = 0.799981688894314 Then
  Else    
      Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=MATCH($F$3,$H$6:$H$9,FALSE)"
      Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
  
      [...]
  
      ***Selection.FormatConditions(1).Priority = 2***
  End If
  </code></pre>