title: How to automatically insert a copied row after a specific value in a cell with VBA
body: <p>I have a table that contains a set of bundles that have to be broken down into their components. For this I'm looking for VBA instructions that will copy any row that contains the tag "-edubnd" at the end of the 'sku' cell (please see table bellow for example) twice underneath itself.</p>
  
  <p>It might be easier to ignore the tag component and use a specific set of values that the code looks for, that's also possible as the values marked as bundles are always the same in the column. What I mean is, instead of looking for the -edubnd tag, the code just looks for a specific value in that column, </p>
  
  <p>I have created a sample table below that is similar-enough to my table in excel that it should serve to illustrate the question.</p>
  
  <p>I'm currently filtering out the dataset, copying it into a different excel document, then running this:</p>
  
  <pre><code>Sub insertrows()
      Dim I As Long
      Dim xCount As Integer
  
  LableNumber:
      xCount = 2
      For I = Range("A" &amp; Rows.CountLarge).End(xlUp).Row To 1 Step -1
          Rows(I).Copy
          Rows(I).Resize(xCount).Insert
      Next
      Application.CutCopyMode = False
  End Sub
  </code></pre>
  
  <h2>Current table:</h2>
  
  <pre><code>column1   |    column2    |  column3 |  column3
  ----------------------------------------------
    A       |      pear     |  blue    |  10
    A       |      apple    |  orange  |  50
    A       |      orange   |  yellow  |  30
    A       |      kiwi     |  yellow  |  20
    A       | orange-edubnd |  blue    |  100
    A       |      apple    |  green   |  10
    A       |  pear-edubnd  |  green   |  50
    A       |      mango    |  pink    |  60
  </code></pre>
  
  <h2>Desired table</h2>
  
  <p><strong>Note:</strong> the copied row after each distinct column2 with the -edubnd tag</p>
  
  <pre><code> column1   |    column2    |  column3 |  column3
  ----------------------------------------------
    A       |      pear     |  blue    |  10
    A       |      apple    |  orange  |  50
    A       |      orange   |  yellow  |  30
    A       |      kiwi     |  yellow  |  20
    A       | orange-edubnd |  blue    |  100
    A       | orange-edubnd |  blue    |  100
    A       | orange-edubnd |  blue    |  100
    A       |      apple    |  green   |  10
    A       |  pear-edubnd  |  green   |  50
    A       |  pear-edubnd  |  green   |  50
    A       |  pear-edubnd  |  green   |  50
    A       |      mango    |  pink    |  60
  </code></pre>