对比两个数据表的数据

Sub yy() 'hlly888

Cells.Interior.ColorIndex = xlNone

Application.ScreenUpdating = False

Dim dc As Object, arr, yrr, i&, j%, tim

tim = Timer

Set dc = CreateObject("scripting.dictionary")

arr = Sheet1.[a1].CurrentRegion

yrr = Sheet2.[a1].CurrentRegion

   For i = 1 To UBound(yrr)

       For j = 1 To UBound(yrr, 2)

           dc(yrr(i, j) & i & j) = ""

       Next

   Next

   For i = 1 To UBound(arr)

       For j = 1 To UBound(arr, 2)

           If Not dc.exists(arr(i, j) & i & j) Then Cells(i, j).Interior.ColorIndex = 3

       Next

   Next

   

Application.ScreenUpdating = True

MsgBox Format(Timer - tim, "0.00") & "秒"

End Sub

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容