|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub test()
Set d = CreateObject("scripting.dictionary")
Set dc = CreateObject("scripting.dictionary")
ar = Sheets("基础总表").[a1].CurrentRegion
For i = 2 To UBound(ar)
If Trim(ar(i, 1)) <> "" Then
d(Trim(ar(i, 1))) = ""
End If
Next i
br = Sheets("明细表").[a1].CurrentRegion
For i = 2 To UBound(br)
If Trim(br(i, 4)) <> "" Then
If Not d.exists(Trim(br(i, 4))) Then
dc(Trim(br(i, 4))) = ""
End If
End If
Next i
If dc.Count > 1 Then
ws = Sheets("基础总表").Cells(Rows.Count, 1).End(xlUp).Row + 1
Sheets("基础总表").Cells(ws, 1).Resize(dc.Count, 1) = Application.Transpose(dc.keys)
End If
End Sub
|
|