Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngA As Range
Dim cntA As Integer
For Each rngA In Target
If rngA = “” Then
Else
cntA = Application.WorksheetFunction.CountIf(ActiveSheet.Range(“A:A”), rngA)’查找的列范围
If cntA > 1 Then
MsgBox “重复数据[” & rngA & “]”, vbCritical, “错误”
rngA=””
End If
End If
Next
End Sub

By jack

Related Post

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

− 2 = 1