The Change event
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then
If Not IsNumeric(Target) Then
MsgBox "Enter a number in cell A1"
Range("A1").ClearContents
Range("A1").Activate
End If
End If
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim VT As Long
'Do all cells in the validation range
'still have validation?
On Error Resume Next
VT = Range("InputRange").Validation.Type
If Err.Number <> 0 Then
Application.Undo
MsgBox "Your last operation was canceled." & _
"It would have deleted data validation rules.", vbCritical
End If
End Sub
No comments:
Post a Comment