清除重复的数据后,数据向上移动,如果选定的多列,向上向右移动(向右不好,以后再改吧)
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim c As Range
On Error Resume Next
If Target.Count > 1 Then
For Each c In Target
Range("iv1").Formula = "=countif(" & Target.Address & "," & c.Address & ")"
If Range("iv1").Value > 1 Then c.ClearContents
Next
Range("iv1").ClearContents
Target.SpecialCells(xlCellTypeBlanks).Delete shift:=xlUp‘向上删除
End If
End Sub