EXCEL跨表比较两列,并填充新值背景
Posted MessageBox
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了EXCEL跨表比较两列,并填充新值背景相关的知识,希望对你有一定的参考价值。
Sub FillNewToYellow() Dim dic Dim oldArr(), updatedArr() On Error Resume Next If Worksheets("old") Is Nothing Then MsgBox "Missing old sheet" ElseIf Worksheets("updated") Is Nothing Then MsgBox "Missing updated sheet" Else Set dic = CreateObject("Scripting.Dictionary") ActiveWorkbook.Sheets("old").Activate oldArr = Range("B1:B" & ActiveSheet.UsedRange.Rows.Count) For i = 1 To UBound(oldArr) dic(oldArr(i, 1)) = "" Next ActiveWorkbook.Sheets("updated").Activate updatedArr = Range("B1:B" & ActiveSheet.UsedRange.Rows.Count) For i = 1 To UBound(updatedArr) If dic.exists(updatedArr(i, 1)) = False Then Rows(i & ":" & i).Select With Selection.Interior .Pattern = xlSolid .PatternColorIndex = xlAutomatic .Color = 65535 ‘Yellow .TintAndShade = 0 .PatternTintAndShade = 0 End With End If Next End If End Sub
以上是关于EXCEL跨表比较两列,并填充新值背景的主要内容,如果未能解决你的问题,请参考以下文章