H o l a:
Te anexo la macro
Sub ReqyOc()
'Por.Dante Amor
Application.ScreenUpdating = False
Application.StatusBar = False
'
Set h1 = Sheets("BDD REQ")
Set h2 = Sheets("BDD OC")
Set h3 = Sheets("resultado")
'
h3.UsedRange.Offset(1, 0).Clear
'
h1.Columns("D").Copy h3.Columns("D")
u = h3.Range("D" & Rows.Count).End(xlUp).Row
With h3.Sort
.SortFields.Clear: .SortFields.Add Key:=h3.Range("D2:D" & u)
.SetRange h3.Range("D1:D" & u): .Header = xlYes: .Apply
End With
h3.Range("D1:D" & u).RemoveDuplicates Columns:=1, Header:=xlYes
u = h3.Range("D" & Rows.Count).End(xlUp).Row
'
j = 2
For i = 2 To u
Application.StatusBar = "Procesando: " & i & " de: " & u
h3.Cells(j, "A") = h3.Cells(i, "D")
Set r = h2.Columns("R")
Set b = r.Find(h3.Cells(i, "D"), lookat:=xlWhole)
If Not b Is Nothing Then
ncell = b.Address
Do
'detalle
h3.Cells(j, "A") = h3.Cells(i, "D")
h3.Cells(j, "B") = h2.Cells(b.Row, "S")
j = j + 1
Set b = r.FindNext(b)
Loop While Not b Is Nothing And b.Address <> ncell
Else
j = j + 1
End If
j = j + 1
Next
Application.ScreenUpdating = True
Application.StatusBar = False
MsgBox "Proceso terminado", vbInformation, "REQUISICIONES Y ORDENES DE COMPRA"
End Sub