View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Arnold Klapheck Arnold Klapheck is offline
external usenet poster
 
Posts: 42
Default Date and error checking

I am trying to give an error message if a user leaves a date field blank,
however my code is not catching it as blank it throws a 13 error message
(which i catch and give a message NOT in correct format
Mytime = Sheets("Program Controls").Range("F8").Value
' F8 is blank
'this is throwing an error 13 when I look at Mytime it shows
12:00:00 AM
If Mytime = "" Or MyTime = Null Or Mytime = #12:00:00 AM# Then
msgbox ("error message, cannot leave date blank")

Handler:
Select Case Err.Number
Case 13
x = MsgBox("Make sure your dates are in the right format MM/DD/YY"

any help would be appreciated,