title: Find Range Based on Interior.ColorIndex - Improve Performance
body: <p>I've written this code to find squared Range spoted with a back ground color.</p>
  <p>My problem is that it thakes 4 or 5 seconds to execute on a large range of 36000 row x 8 columns.</p>
  <p>Do you have suggestions to improve and speed the code quoted below ?</p>
  <pre><code>Function RegionColoree(cel As Range)
  
  i = 0
  ii = 0
  j = 0
  jj = 0
  
  Set cel = cel.Resize(1, 1)
  
  
  If Not cel.Interior.ColorIndex = xlNone Then
  
      Do While cel.Offset(i).Interior.ColorIndex &lt;&gt; xlNone 'vers le bas
          i = i + 1
      Loop
      Do While cel.Offset(ii).Interior.ColorIndex &lt;&gt; xlNone 'vers le haut
          ii = ii - 1
      Loop
      Do While cel.Offset(, j).Interior.ColorIndex &lt;&gt; xlNone 'vers la droite
          j = j + 1
      Loop
      Do While cel.Offset(, jj).Interior.ColorIndex &lt;&gt; xlNone 'vers la gauche
          jj = jj - 1
      Loop
      
      ii = ii + 1
      jj = jj + 1
      
      RegionColoree = cel.Offset(ii, jj).Resize(i - ii, j - jj).Address
      
  End If
  
  End Function
  </code></pre>