我在列A中将具有以下值; A1:11/5,A2:11/5R,A3:11/6,A4:11/7,A5:11/5 $,A6:11/5根据文本和符号标记单元格值
我想将这些单元标记为重复第10列如果数字相同而不考虑结束符号:例如:A1,A2,A5,A6是重复的,应在Col J1,J2,J5和J6中标记。
以下代码仅适用于数字。它不会计算单元格值的结束符号。任何建议来修改代码以获得所需的输出,我们感激。
Sub FindDuplicates()
Dim LastRow As Long, matchFoundIndex As Long, iCntr As Long
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
For iCntr = 1 To LastRow ' 1 set the start of the dup looks
If Cells(iCntr, 1) <> "" Then
matchFoundIndex = WorksheetFunction.Match(Cells(iCntr, 1), Range("A1:A" & LastRow), 0)
If iCntr <> matchFoundIndex Then
Cells(iCntr, 10) = "Duplicate"
Else
Cells(iCntr, 10) = "E"
End If
End If
Next
End Sub
谢谢
什么的Excel版本? – user2676140
@user,它是2007 – Kuma