Te anexo la macro
Sub Concatenar_Datos()
'Por Dante Amor
Application.ScreenUpdating = False
Application.StatusBar = False
Set h1 = Sheets("Hoja1") 'hoja con datos
Set h2 = Sheets("Hoja2") 'hoja destino
h2.Rows("2:" & Rows.Count).Clear
u1 = h1.Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To u1
Application.StatusBar = "Procesando registro " & i & " de " & u1
rfc = h1.Cells(i, "H").Value
Set b = h2.Columns("A").Find(rfc, LookIn:=xlValues, lookat:=xlWhole)
If Not b Is Nothing Then
u2 = b.Row
If h1.Cells(i, "A").Value = "P" Then
h2.Cells(u2, "F").Value = h2.Cells(u2, "F").Value & h1.Cells(i, "E").Value 'partida per
h2.Cells(u2, "G").Value = h1.Cells(i, "A").Value 'per
h2.Cells(u2, "H").Value = h2.Cells(u2, "H").Value & h1.Cells(i, "B").Value & "|" 'tipo per
h2.Cells(u2, "I").Value = h2.Cells(u2, "I").Value & h1.Cells(i, "F").Value & "|" 'importe
Else
h2.Cells(u2, "J").Value = h1.Cells(i, "A").Value 'dedu
h2.Cells(u2, "K").Value = h2.Cells(u2, "K").Value & h1.Cells(i, "B").Value & "|" 'tipo per
h2.Cells(u2, "L").Value = h2.Cells(u2, "L").Value & h1.Cells(i, "E").Value & "|" 'tipo dedu
h2.Cells(u2, "M").Value = h2.Cells(u2, "M").Value & h1.Cells(i, "F").Value & "|" 'importe
End If
Else
u2 = h2.Range("A" & Rows.Count).End(xlUp).Row + 1
h2.Cells(u2, "A").Value = h1.Cells(i, "H").Value 'rfc
h2.Cells(u2, "B").Value = h1.Cells(i, "I").Value 'nombre
h2.Cells(u2, "C").Value = h1.Cells(i, "G").Value 'afil
h2.Cells(u2, "D").Value = h1.Cells(i, "B").Value 'tipo pen
h2.Cells(u2, "E").Value = h1.Cells(i, "C").Value 'tipo nom
'
If h1.Cells(i, "A").Value = "P" Then
h2.Cells(u2, "F").Value = h1.Cells(i, "E").Value & "|" 'partida per
h2.Cells(u2, "G").Value = h1.Cells(i, "A").Value 'per
h2.Cells(u2, "H").Value = h1.Cells(i, "B").Value & "|" 'tipo per
h2.Cells(u2, "I").Value = h1.Cells(i, "F").Value & "|" 'importe
Else
h2.Cells(u2, "J").Value = h1.Cells(i, "A").Value 'dedu
h2.Cells(u2, "K").Value = h1.Cells(i, "B").Value & "|" 'tipo per
h2.Cells(u2, "L").Value = h1.Cells(i, "E").Value & "|" 'tipo dedu
h2.Cells(u2, "M").Value = h1.Cells(i, "F").Value & "|" 'importe
End If
End If
Next
h2.Select
Application.ScreenUpdating = True
Application.StatusBar = False
MsgBox "Fin concatenar"
End Sub
.
.Sal u dos. Dante Amor. No olvides valorar la respuesta. G racias
.