G
Guest
Hi,
I want to write a macro that should check if the value in Cell C3 is in
valid date format. If it is not then, it should clear the contents and alert
the user to enter the value only in Date format.
Also, the macro should check if the cell is empty or not. Incase it is empty
then it should ask the user to enter the date of scheduled audit.
However, my problem is that On error code is being executed, even when the
cell is empty !
Here is the piece of code:
On Error Resume Next ' should be executed only when the cell value overflows
Range("c3").ClearContents
msg = MsgBox(" Pls enter a valid date", vbOKOnly, "Enter the Date")
If IsEmpty(Range("C3").Value) Then ' should be executed when the cell
is empty
Ans = MsgBox(" Pls enter the date of the scheduled audit", vbOKCancel,
"Enter the Date")
End
thanks
I want to write a macro that should check if the value in Cell C3 is in
valid date format. If it is not then, it should clear the contents and alert
the user to enter the value only in Date format.
Also, the macro should check if the cell is empty or not. Incase it is empty
then it should ask the user to enter the date of scheduled audit.
However, my problem is that On error code is being executed, even when the
cell is empty !
Here is the piece of code:
On Error Resume Next ' should be executed only when the cell value overflows
Range("c3").ClearContents
msg = MsgBox(" Pls enter a valid date", vbOKOnly, "Enter the Date")
If IsEmpty(Range("C3").Value) Then ' should be executed when the cell
is empty
Ans = MsgBox(" Pls enter the date of the scheduled audit", vbOKCancel,
"Enter the Date")
End
thanks