excel去除重复 比如:A B C D 1 a1 b1 c1 d1 2 a2 b1 c1 d1 3 a3 b2 c2 c2 4 a4 b2 c2 c2请问怎样可以把1/3,或2/4删除?
问题描述:
excel去除重复 比如:A B C D 1 a1 b1 c1 d1 2 a2 b1 c1 d1 3 a3 b2 c2 c2 4 a4 b2 c2 c2
请问怎样可以把1/3,或2/4删除?
答
用VBA方法解决,代码如下:
Sub 去除重复()
Sheets("sheet1").Select
i = 0
j = 0
k = 0
l = 0
m = 2
For i = 1 To 4
For j = 1 To 4
For k = m To 4
For l = 1 To 4
If Cells(k, l) = Cells(i, j) Then
Cells(k, l).Select
Selection.ClearContents
End If
Next l
Next k
Next j
m = m + 1
Next i
End Sub