title: excel macro to create new row for number diff
body: <p>I need to take column A which has 2 values in a single cell and create a row for each number between the two values but keeping the rest of the columns the same as it was in the original row. </p>
  
  <p><img src="https://i.stack.imgur.com/3zStK.jpg" alt="enter image description here"></p>
  
  <p>Here is my current macro.</p>
  
  <p>Sub Macro1()
  '
  ' Macro1 Macro
  '</p>
  
  <p>'
      Dim CellValue As String
      strcellvalue = Replace(Range("A9").Value, " ", "")
      If InStr(strcellvalue, "-") Then
          Dim intCurrentBIN As Double
          Dim intLastBIN As Double
          Dim intMainRow As Integer
          Dim intNewRow As Integer
          intMainRow = 9
          intNewRow = intMainRow + 1</p>
  
  <pre><code>    intCurrentBIN = CDbl(Left(strcellvalue, InStr(strcellvalue, "-") - 1))
      intLastBIN = CDbl(Right(strcellvalue, Len(strcellvalue) - InStr(strcellvalue, "-")))
  
          Do While intCurrentBIN &lt; (intLastBIN + 1)
              Rows(intMainRow &amp; ":" &amp; intMainRow).Select
              Selection.Copy
              Rows(intNewRow &amp; ":" &amp; intNewRow).Select
              Selection.Insert Shift:=xlDown
              Range("A" &amp; intNewRow).Select
              ActiveCell.FormulaR1C1 = intCurrentBIN
              intNewRow = intNewRow + 1
              intCurrentBIN = intCurrentBIN + 1
          Loop
      Rows(intMainRow &amp; ":" &amp; intMainRow).Select
      Selection.Delete
  End If
  </code></pre>
  
  <p>End Sub</p>