Try this is new sheet:-
Sub MG06Feb06
Dim Rng As Range, Dn As Range
Dim n As Integer
Dim Sht As Variant
Dim Q
Dim Ac As Integer
Dim Temp As Double
Dim col As Integer
For Sht = 0 To UBound(Array("company-A", "company-B"))
With Sheets(Array("company-A", "company-B")(Sht))
Set Rng = .Range(.Range("A1"), .Range("A" & Rows.Count).End(xlUp))
End With
With CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
For Each Dn In Rng
If Not .Exists(Dn.Value) Then
.Add Dn.Value, Array(Dn, Dn(, 2), Dn(, 3), Dn(, 4))
Else
Q = .Item(Dn.Value)
For n = 1 To 3
Q(n) = IIf(Abs(Dn(, n + 1)) > 0, Dn(, n + 1), Q(n))
Next n
.Item(Dn.Value) = Q
End If
Next
col = IIf(Sht = 1, 5, 1)
Cells(1, col).Resize(.Count, 4) = Application.Transpose(Application.Transpose(.items))
End With
Next Sht
End Sub
Regards Mick
Bookmarks