|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub 条件去重()
Dim arr, brr, d, i&, s&
Set d = CreateObject("scripting.dictionary")
tj = [b5]: rq = [q5]
arr = Range("b6:e" & Cells(Rows.Count, 5).End(xlUp).Row)
ReDim brr(1 To UBound(arr), 1 To 1)
For i = 1 To UBound(arr)
If arr(i, 1) <> tj And arr(i, 3) <= rq And arr(i, 4) <> "" Then
If Not d.exists(arr(i, 4)) Then
s = s + 1
d(arr(i, 4)) = ""
brr(s, 1) = arr(i, 4)
End If
End If
Next
if s>0 then
Unprotect Password:="123"
Range("m6:m300").ClearContents
Range("m6").Resize(s) = brr
Protect Password:="123", DrawingObjects:=True, Contents:=True, Scenarios:=False, UserInterfaceOnly:=False, AllowFormattingCells:=False, AllowFormattingColumns:=False, AllowFormattingRows:=False, AllowInsertingColumns:=False, AllowInsertingRows:=False, AllowInsertingHyperlinks:=False, AllowDeletingColumns:=False, AllowDeletingRows:=False, AllowSorting:=True, AllowFiltering:=True, AllowUsingPivotTables:=False
endif
End Sub
|
评分
-
1
查看全部评分
-
|