excel中假設在A列需要找到相同數值的單元格,在B1輸入以下公式
=IF(COUNTIF($A$1:A1,A1)>1,"重複","0")。
然後往下拖,只要是重複,後面就會顯示“重複”兩個字,顯示0的就是不重複,一目瞭然。
2、Ctrl+H替換視窗,把重複兩個字替換為空(就是“替換為”那裡什麼也不輸入),全部替換。
Dim rCell As Range, rRng As Range, dRng As Range
On Error Resume Next
Application.ScreenUpdating
Set rRng = Range("A1:A" & Range("A65536").End(xlUp).Row)
rRng.AdvancedFilter
For Each rCell In rRng
If
rCell.EntireRow.Hidden
If dRng Is Nothing Then
Set dRng =
rCell.EntireRow
Else
Set dRng = Application.Union(dRng, rCell.EntireRow)
End If
Next
If Not dRng Is Nothing Then
dRng.Delete
ActiveSheet.ShowAllData
End Sub
excel中假設在A列需要找到相同數值的單元格,在B1輸入以下公式
=IF(COUNTIF($A$1:A1,A1)>1,"重複","0")。
然後往下拖,只要是重複,後面就會顯示“重複”兩個字,顯示0的就是不重複,一目瞭然。
2、Ctrl+H替換視窗,把重複兩個字替換為空(就是“替換為”那裡什麼也不輸入),全部替換。
Dim rCell As Range, rRng As Range, dRng As Range
On Error Resume Next
Application.ScreenUpdating
= FalseSet rRng = Range("A1:A" & Range("A65536").End(xlUp).Row)
rRng.AdvancedFilter
Action:=xlFilterInPlace, unique:=TrueFor Each rCell In rRng
If
rCell.EntireRow.Hidden
= True ThenIf dRng Is Nothing Then
Set dRng =
rCell.EntireRow
Else
Set dRng = Application.Union(dRng, rCell.EntireRow)
End If
End If
Next
If Not dRng Is Nothing Then
dRng.Delete
ActiveSheet.ShowAllData
Application.ScreenUpdating
= TrueEnd Sub