Te anexo la macro completa
Sub calculo1()
'Por.Dante Amor
Set h1 = Sheets("Clientes")
Set h2 = Sheets("Mayor")
'
'Para COBMA y DGRL
For i = 3 To h1.Range("H" & Rows.Count).End(xlUp).Row
cob = 0
dgr = 0
Set r = h2.Columns("I")
Set b = r.Find(h1.Cells(i, "H"), lookat:=xlWhole)
If Not b Is Nothing Then
celda = b.Address
Do
'detalle
If h2.Cells(b.Row, "J") = "COBMA" Then
cob = cob + h2.Cells(b.Row, "E")
End If
If h2.Cells(b.Row, "J") = "DGRAL" Then
dgr = dgr + h2.Cells(b.Row, "E")
End If
Set b = r.FindNext(b)
Loop While Not b Is Nothing And b.Address <> celda
h1.Cells(i, "R") = cob
h1.Cells(i, "S") = dgr
End If
Next
'
'En el caso de DVENT
For i = 2 To h2.Range("I" & Rows.Count).End(xlUp).Row
If h2.Cells(i, "J") = "DVENT" Then
Set b = h1.Columns("H").Find(h2.Cells(i, "I"), lookat:=xlWhole)
If b Is Nothing Then
u = h1.Range("H" & Rows.Count).End(xlUp).Row + 1
h1.Cells(u, "C") = h2.Cells(i, "A")
h1.Cells(u, "D") = h2.Cells(i, "B")
h1.Cells(u, "G") = h2.Cells(i, "G")
h1.Cells(u, "H") = h2.Cells(i, "I")
h1.Cells(u, "K") = h2.Cells(i, "Q")
h1.Cells(u, "N") = h2.Cells(i, "E")
End If
End If
Next
MsgBox "Pareo terminado"
End Sub
' : )
'S aludos. Dante Amor. Recuerda valorar la respuesta. G racias
' : )