Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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, |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date and error checking
I figured it out insteat of assigning to variable use the cell reference
then assign to variable just befor error handler. If Sheets("Program Controls").Range("F8").Value = "" Then x = MsgBox("You must enter Period From Date", vbCritical, "Error") Range("PeriodFrom").Select Range("PeriodFrom").Activate End end if |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Error checking | Excel Discussion (Misc queries) | |||
Error Checking | Excel Discussion (Misc queries) | |||
Error Checking | Excel Discussion (Misc queries) | |||
Error Checking | Excel Discussion (Misc queries) | |||
Error Checking | Excel Programming |