title: Macro to merge and concatenate cells in Excel for rows in which information on other columns matches
body: <p>apologize if this is a common post, but couldn't find something that fully applies to me. </p>
  
  <p>It's a very similar post to (except that instead of just merging the 2 cells, i am looking to merge and concatenate): 
  <a href="https://stackoverflow.com/questions/20547189/macro-to-merge-cells-in-excel-for-rows-in-which-information-in-other-columns-mat">Macro to merge cells in Excel for rows in which information in other columns matches</a></p>
  
  <p>Referencing the image in the post above, what i am looking for are cells P2 and P3 to be merged and the data to be concatenated. For eg: if P2 had abc, and P3 had xyz, i am looking for end product to be abcxyz in the merged cell. </p>
  
  <p>Any help would be greatly appreciated. What i have only enables me to merge, but i am not sure how to concatenate it.  </p>
  
  <p>Sub Main()</p>
  
  <pre><code>Dim i As Long
  Dim j As Long
  
  Dim sameRows As Boolean
  sameRows = True
  
  For i = 1 To Range("A" &amp; Rows.Count).End(xlUp).Row
      For j = 1 To 6
          If StrComp(Cells(i, j), Cells(i + 1, j), vbTextCompare) Then
              sameRows = False
          End If
      Next j
  
      If sameRows Then
          Range(Cells(i, 7), Cells(i + 1, 7)).Merge
      End If
  
      sameRows = True
  Next i
  </code></pre>
  
  <p>End Sub</p>