是一个调用Excel删除重复值功能批量删除多列每一列的重复值的VBA代码Sub Macro1()
Dim i, j
For i = 1 To [a1].End(xlToRight).Column
ActiveSheet.Range(Cells(1, i), Cells(Cells(1048576, i).End(xlUp).Row, i)).RemoveDuplicates Columns:=1, Header:=xlNo
Next
End Sub

解决方案 »

  1.   

    Sub Macro1()
            Dim i, j
            
            For i = 1 To [a1].End(xlToRight).Column
                    ActiveSheet.Range(Cells(1, i), Cells(ActiveSheet.Cells(1048576, i).End(xlUp).Row, i)).RemoveDuplicates Columns:=1, Header:=xlNo
            Next
    End Sub
      

  2.   

    Sub Macro1()
            Dim i, j
            
            For i = 1 To [a1].End(xlToRight).Column
                    ActiveSheet.Range(Cells(1, i), Cells(ActiveSheet.Cells(1048576, i).End(xlUp).Row, i)).RemoveDuplicates Columns:=1, Header:=xlNo
            Next
    End SubCells(ActiveSheet.Cells(1048576, i).End(xlUp).Row, i)