我有数据显示两个列表之间的重复项。我正在尝试删除有重复的单元格,只显示不匹配的单元格。因此,我不能删除行,只能删除单元格来实现我正在尝试的内容。我尝试了内置的查找重复功能,但它不起作用。
这是我的工作表的样子:
我在这里找到了这段代码:
Sub RowDelete()
Application.ScreenUpdating = False
Dim myRow As Integer
Dim myCol As Integer
Dim Counter As Integer
Counter = 0
myCol = 1
rBegin = 1
rEnd = 100
For myRow = rEnd To rBegin Step -1
Application.StatusBar = Counter & " rows deleted."
If Cells(myRow, myCol).Interior.ColorIndex = xlNone Then
Cells(myRow, myCol).EntireRow.Delete
Counter = Counter + 1
End If
Next myRow
Application.StatusBar = False
Application.ScreenUpdating = True
x = MsgBox(Counter & " rows deleted.", vbOKOnly, "Rows Deleted")
End Sub
我需要帮助更改它以仅删除具有此格式的单元格而不是行:
With formatCols.FormatConditions(1).Font
.Color = -16383844
.TintAndShade = 0
End With
With formatCols.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 13551615
.TintAndShade = 0
End With