Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Checking for invalid dates

Hi folks,

I have come across an annoying problem in Excel.

I have a cell in an Excel 97 worksheet, with a format of
dd/mm/yy.

Before Close of the worksheet, I run a few validation
checks on various cells, including this date cell. It
appears that the IsDate function doesn't work when I have
a date of 40/01/03, yet it does work if I type in 40/01/94.

I can only imagine that Excel is reformatting the first
date and assuming that 40 is the year (when in fact it is
the day). Having reformatted it, it then treats it as a
valid date. My worry is that a user mistypes the date, and
it could potentially be treated as a valid date.

Is there any way of turning off this behaviour of trying
to interpret dates rather than taking them literally?


Cheers,

Matt


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Checking for invalid dates

On Thu, 27 Nov 2003 07:57:18 -0800, "Matt Pinto"
wrote:

Hi folks,

I have come across an annoying problem in Excel.

I have a cell in an Excel 97 worksheet, with a format of
dd/mm/yy.

Before Close of the worksheet, I run a few validation
checks on various cells, including this date cell. It
appears that the IsDate function doesn't work when I have
a date of 40/01/03, yet it does work if I type in 40/01/94.

I can only imagine that Excel is reformatting the first
date and assuming that 40 is the year (when in fact it is
the day). Having reformatted it, it then treats it as a
valid date. My worry is that a user mistypes the date, and
it could potentially be treated as a valid date.

Is there any way of turning off this behaviour of trying
to interpret dates rather than taking them literally?


Cheers,

Matt



You could try using Data Validation.


--ron
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Checking for invalid dates

Hi Ron,

Many thanks for that! It works a treat.
I didn't even know the Data Validation Menu Option was
there, and it will allow me to remove a lot of VBA code.

Once again, many thanks.

Matt



-----Original Message-----
On Thu, 27 Nov 2003 07:57:18 -0800, "Matt Pinto"
wrote:

Hi folks,

I have come across an annoying problem in Excel.

I have a cell in an Excel 97 worksheet, with a format of
dd/mm/yy.

Before Close of the worksheet, I run a few validation
checks on various cells, including this date cell. It
appears that the IsDate function doesn't work when I

have
a date of 40/01/03, yet it does work if I type in

40/01/94.

I can only imagine that Excel is reformatting the first
date and assuming that 40 is the year (when in fact it

is
the day). Having reformatted it, it then treats it as a
valid date. My worry is that a user mistypes the date,

and
it could potentially be treated as a valid date.

Is there any way of turning off this behaviour of trying
to interpret dates rather than taking them literally?


Cheers,

Matt



You could try using Data Validation.


--ron
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Checking for invalid dates

On Fri, 28 Nov 2003 01:39:07 -0800, "Matt Pinto"
wrote:

Many thanks for that! It works a treat.
I didn't even know the Data Validation Menu Option was
there, and it will allow me to remove a lot of VBA code.

Once again, many thanks.

Matt


Glad to help.

Whatever algorithm is used in Data Validation seems to work better for dates
than the IsDATE VBA function.

You can also use Data Validation to cause messages to pop-up when the cell is
selected.


--ron
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
Checking Dates against Bank Holidays Gary T Excel Worksheet Functions 2 November 19th 07 03:03 PM
Spell Checking with checking cell notes jfitzpat Excel Discussion (Misc queries) 0 August 8th 07 10:26 PM
How do I fix an Invalid Reference? Nic New Users to Excel 1 June 1st 06 04:43 PM
Sumproduct checking between two dates bikergsx Excel Worksheet Functions 2 May 26th 06 10:21 AM
Checking Military Dates Otto Moehrbach[_3_] Excel Programming 14 July 13th 03 05:24 PM


All times are GMT +1. The time now is 08:19 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"