美元兑墨西哥比索情况:如何让EXCEL表格自动找出重复的
来源:百度文库 编辑:神马品牌网 时间:2024/07/01 11:52:51
excel自动筛选出重复内容的方法与步骤:
运行条件格式→重复值。
详细操作及演示:
1.选中目标单元格区域。
2.开始→条件格式→重复值。
3.选择颜色。
4.确定,完成。
'按下 Alt+F11 组合键, 输入并运行(按F5键即可运行)下列代码:
'本示例在指定工作表的列中对数据进行排序,然后删除包含重复数据的行。
Sub DeleteColumnDupes()
Dim strSheetName As String, strColumnLetter As String
strSheetName = "Sheet1" ' 删除工作表中的重复行
strColumnLetter = "A" ' 以 A 列中的重复项作为删除条件
Dim strColumnRange As String
Dim rngCurrentCell As Range
Dim rngNextCell As Range
strColumnRange = strColumnLetter & "1"
Worksheets(strSheetName).Range(strColumnRange).Sort _
Key1:=Worksheets(strSheetName).Range(strColumnRange)
Set rngCurrentCell = Worksheets(strSheetName).Range(strColumnRange)
Do While Not IsEmpty(rngCurrentCell)
Set rngNextCell = rngCurrentCell.Offset(1, 0)
If rngNextCell.Value = rngCurrentCell.Value Then
rngCurrentCell.EntireRow.Delete
End If
Set rngCurrentCell = rngNextCell
Loop
End Sub