Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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,
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error checking jason2444 Excel Discussion (Misc queries) 3 August 28th 07 09:29 PM
Error Checking SammyB Excel Discussion (Misc queries) 2 June 4th 07 10:48 AM
Error Checking Lost in Microbiology Excel Discussion (Misc queries) 8 May 11th 07 05:36 AM
Error Checking mworth01 Excel Discussion (Misc queries) 1 May 18th 06 08:45 PM
Error Checking Jason Zischke Excel Programming 1 February 16th 06 02:32 AM


All times are GMT +1. The time now is 07:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"