title: Duplicate rows based on cell content and identifying primary value
body: <p>I'm looking for exactly this operation:
  <a href="https://stackoverflow.com/questions/44732943/how-do-i-duplicate-rows-based-on-cell-contents-cell-contains-semi-colon-seperat">How do I duplicate rows based on cell contents (cell contains semi-colon seperated data)</a></p>
  
  <p>But with an added column:
  <a href="https://i.stack.imgur.com/abhnv.jpg" rel="nofollow noreferrer">Starting table vs End result</a></p>
  
  <p>What I have:</p>
  
  <pre><code>| Name   | Size       | Photo   |
  |--------|------------|---------|
  | Tshirt | 10, 12, 14 | 144.jpg |
  | Jeans  | 30, 40, 42 | 209.jpg |
  | Dress  | 8          | 584.jpg |
  | Shoe   | 6          | 178.jpg |
  </code></pre>
  
  <p>What I would like:</p>
  
  <pre><code>| Name   | Size | Photo   | Primary |
  |--------|------|---------|---------|
  | Tshirt | 10   | 144.jpg | 1       |
  | Tshirt | 12   | 144.jpg | 0       |
  | Tshirt | 14   | 144.jpg | 0       |
  | Jeans  | 30   | 209.jpg | 1       |
  | Jeans  | 40   | 209.jpg | 0       |
  | Jeans  | 42   | 209.jpg | 0       |
  | Dress  | 8    | 584.jpg | 1       |
  | Shoe   | 6    | 178.jpg | 1       |
  </code></pre>
  
  <p>Right now the code I found works perfectly but I don't know how to add the "Primary" column.</p>
  
  <pre><code>Sub SplitCell()
  Dim cArray As Variant
  Dim cValue As String
  Dim rowIndex As Integer, strIndex As Integer, destRow As Integer
  Dim targetColumn As Integer
  Dim lastRow As Long, lastCol As Long
  Dim srcSheet As Worksheet, destSheet As Worksheet
  
  targetColumn = 2 'column with semi-colon separated data
  
  Set srcSheet = ThisWorkbook.Worksheets("Sheet1") 'sheet with data
  Set destSheet = ThisWorkbook.Worksheets("Sheet2") 'sheet where result will be displayed
  
  destRow = 0
  With srcSheet
      lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
      lastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
      For rowIndex = 1 To lastRow
          cValue = .Cells(rowIndex, targetColumn).Value 'getting the cell with semi-colon separated data
          cArray = Split(cValue, ";") 'splitting semi-colon separated data in an array
          For strIndex = 0 To UBound(cArray)
              destRow = destRow + 1
              destSheet.Cells(destRow, 1) = .Cells(rowIndex, 1)
              destSheet.Cells(destRow, 2) = Trim(cArray(strIndex))
              destSheet.Cells(destRow, 3) = .Cells(rowIndex, 3)
          Next strIndex
      Next rowIndex
  End With
  End Sub
  </code></pre>
  
  <p>Thanks for your help!</p>