ظهرت الرسالة في الكود بحروف غريبة فقمت يتغيير الكود كالتالي:
Private Sub Worksheet_Change(ByVal Target As Range)
If HasValidation(Range("ValidationRange")) Then
Exit Sub
Else
Application.Undo
MsgBox "The operation has been cancelled." & _
"As data validation rules were about to be deleted.", vbCritical, "YasserKhalil"
End If
End Sub
Private Function HasValidation(r) As Boolean
On Error Resume Next
x = r.Validation.Type
If Err.Number = 0 Then HasValidation = True Else HasValidation = False
End Function