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
比格高
逼格更高