Sub 矩形1_Click()
i = Range("A65536").End(xlUp).Row
For s = 1 To i
For ss = i To s + 1 Step -1
If Cells(ss, 1) = Cells(s, 1) Then
Cells(ss, 1).Delete shift:=xlUp
End If
Next ss
Next s
End Sub
Sub 矩形2_Click()
i = Range("A65536").End(xlUp).Row
For s = i To 1 Step -1
If Application.WorksheetFunction.CountIf(Range(Cells(1, 1), Cells(s, 1)), Cells(s, 1)) > 1 Then
Cells(s, 1).Delete shift:=xlUp
End If
Next
End Sub
Sub 矩形3_Click()
i = Range("A65536").End(xlUp).Row
Dim dic As Object, ii&, arr, ra
Set dic = CreateObject("Scripting.Dictionary")
arr = Range("a1:a" & i)
For ii = 1 To UBound(arr)
ra = dic(arr(ii, 1))
Next
Range("a:a").ClearContents
Range("a1").Resize(dic.Count, 1) = Application.Transpose(dic.Keys)
End Sub
Sub 矩形4_Click()
Columns(1).RemoveDuplicates 1
End Sub
VBA去重复的几种方法
最新推荐文章于 2024-05-21 19:15:40 发布