我試過下面的宏代碼,但它不是強調從第二個實例重複PLZ幫我出高亮重複值,從孔片範圍(UsedRange)
還有一件事IAM努力做與動態不採取固定範圍(特定範圍)
Sub FindingDuolicate()
Dim Rng As Range
Dim rngCell As Variant
Dim Flag As Long
ActiveSheet.UsedRange.Select
Flag = 0
For Each Rng In Selection
If (WorksheetFunction.CountIf(Selection, Rng.Value) > 1) Then
Rng.Interior.Color = vbRed
Flag = Flag + 1
Else
Rng.Interior.Pattern = xlNone
End If
Next
If Flag > 0 Then
MsgBox Flag & " Cells (in red) Contain an Duplicate Data. Please Check"
Else
MsgBox " Data Validation Completed . No Duplicate Found. "
End If
End Sub
'昏暗的標誌作爲Long'(不' Dim LR');和'xlNone'不是'x1None'(L不是1)。 –
@ A.S.H對不起,這是輸入錯誤,我糾正了這一點。但我需要幫助plz幫助我,如果你能 –
你的宏爲我工作與上述更正,雖然沒有測試幾乎。你怎麼調用它?還要添加Option Explicit,這對於幫助你發現許多錯誤非常有用。 –