|
小改一下,加上颜色- Sub ykcbf() '//2024.6.4
- Dim arr, d
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- With Sheets("票")
- r = .Cells(.Rows.Count, 4).End(xlUp).Row
- arr = .[d1].Resize(r, 6)
- End With
- For i = 2 To UBound(arr)
- s = CStr(arr(i, 1))
- d(s) = i
- Next
- On Error Resume Next
- With Sheets("中心")
- r = .Cells(.Rows.Count, "d").End(xlUp).Row
- brr = .[d1].Resize(r, 5)
- For i = 2 To UBound(brr)
- s = CStr(brr(i, 1))
- If d.Exists(s) Then
- .Cells(i, 6) = arr(d(s), 4)
- .Cells(i, 7) = arr(d(s), 5)
- .Cells(i, 8) = arr(d(s), 6)
- Else
- .Cells(i, 6).Resize(, 3).Cells.Interior.ColorIndex = 6
- End If
- Next
- End With
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|