|
莫悠悠 发表于 2014-5-19 18:13
表1的名字可能与表2的名字不一致,如何找到不一致的名单,并标出来源。
表1的名字是掌握在报账部门的基础 ... - Sub Macro1()
- Dim d(1 To 2) As Object, arr, i&, j&
- For j = 1 To 2
- Set d(j) = CreateObject("scripting.dictionary")
- arr = Sheets(j).[a1].CurrentRegion
- For i = 2 To UBound(arr)
- d(j)(arr(i, 1)) = ""
- Next
- Next
- For i = 2 To UBound(arr)
- If d(1).Exists(arr(i, 1)) And d(2).Exists(arr(i, 1)) Then
- d(1).Remove (arr(i, 1))
- d(2).Remove (arr(i, 1))
- End If
- Next
- For i = 1 To 2
- With Sheets(i + 2)
- .Cells.ClearContents
- .[a1].Resize(d(i).Count) = WorksheetFunction.Transpose(d(i).Keys)
- End With
- Next
- End Sub
复制代码 |
|