EXCEL VBA二个不同区域内容相同的保留一个,不相同的删除
1个回答
展开全部
Sub s()
Dim rg1 As Range, rg2 As Range, c As Range
Set rg1 = [a39:j1038]
Set rg2 = [L78:U1110]
Set d = CreateObject("scripting.dictionary")
For Each c In rg1
If c <> "" Then d(c.Text) = 1
Next
For Each c In rg2
If c <> "" Then d(c.Text) = d(c.Text) + 1
Next
For Each c In rg1
If d(c.Text) <> 2 Then c = ""
Next
rg2 = ""
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询