|
Sub TEXT()
Dim r%, i%
Dim arr, brr
Dim d As Object
Set d = CreateObject("scripting.dictionary")
r = Worksheets("2").Cells(Rows.Count, 1).End(xlUp).Row
arr = Worksheets("2").Range("a2:aa" & r)
For i = 1 To UBound(arr)
d(arr(i, 2)) = i
Next
With Worksheets("1")
r = .Cells(.Rows.Count, 8).End(xlUp).Row - 1
brr = .Range("h2:j" & r)
For i = 1 To UBound(brr)
If d.exists(brr(i, 1)) Then
arr(d(brr(i, 1)), 27) = brr(i, 3)
Else
.Cells(i + 1, "h").Interior.ColorIndex = 6
End If
Next
End With
Worksheets("2").Range("a2:aa" & UBound(arr)) = arr
End Sub
|
|