|
Something like this - you can modify whatever range you want to check for this line: Set MyRng = Range("A2:A1000")- Sub Test()
- Dim MyRng As Range, Cel As Range, Msg As String
- Set MyRng = Range("A2:A1000") ' <--- Modify to your own Range here !!!!!
- For Each Cel In MyRng
- If Not IsEmpty(Cel) Then
- If WorksheetFunction.CountIf(MyRng, Cel) > 1 Then
- If Msg = "" Then
- Msg = "Duplicated Cells: " & Cel.Address(0, 0)
- Else
- Msg = Msg & "; " & Cel.Address(0, 0)
- End If
- End If
- End If
- Next Cel
- MsgBox Msg
- End Sub
复制代码 |
|