Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 846
Default Before Cell Exit

Thanks for taking the time to read my question.

I want to write a function that is executed before the user exits a specific
cell. The purpose is to check the format of the date that has been entered,
and make the user correct it if it's wrong.
The reason is I'm getting stuff like:
Mar. 12-2010
12/Mar-10
10-12-Mar
12.2010.03

Some are date formats and some aren't even close...

Dates will be in a specific column or specific cell, so I need to execute
the function before the user leaves that cell or column. Not sure how to do
that. I know in MS Access there is a BeforeUpdate, but don't see anything
like that in Excel.

Thanks for your help

Brad
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 420
Default Before Cell Exit

Maybe you don't need code.

Maybe data|Validation (specify a date and a range of valid dates) that can be used.

You could format the cell the way you like. I'd use an unambiguous date format
like: dd-mmm-yyyy

Be aware that Data|Validation can be broken pretty easily, but if the users are
typing (not copy|pasting), you may be ok.

======
That said. There is a worksheet_Change event that you may be able to tie into.

Brad wrote:

Thanks for taking the time to read my question.

I want to write a function that is executed before the user exits a specific
cell. The purpose is to check the format of the date that has been entered,
and make the user correct it if it's wrong.
The reason is I'm getting stuff like:
Mar. 12-2010
12/Mar-10
10-12-Mar
12.2010.03

Some are date formats and some aren't even close...

Dates will be in a specific column or specific cell, so I need to execute
the function before the user leaves that cell or column. Not sure how to do
that. I know in MS Access there is a BeforeUpdate, but don't see anything
like that in Excel.

Thanks for your help

Brad


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Before Cell Exit

VBA Won't run inside of a cell. Take a look at this:
http://www.contextures.com/xlDataVal06.html#Date

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Brad" wrote:

Thanks for taking the time to read my question.

I want to write a function that is executed before the user exits a specific
cell. The purpose is to check the format of the date that has been entered,
and make the user correct it if it's wrong.
The reason is I'm getting stuff like:
Mar. 12-2010
12/Mar-10
10-12-Mar
12.2010.03

Some are date formats and some aren't even close...

Dates will be in a specific column or specific cell, so I need to execute
the function before the user leaves that cell or column. Not sure how to do
that. I know in MS Access there is a BeforeUpdate, but don't see anything
like that in Excel.

Thanks for your help

Brad

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
Exit Field vs Exit Button...... roy_ware Excel Programming 2 October 10th 07 04:05 PM
change cell on exit vba Joost Excel Programming 6 June 12th 07 02:00 PM
How do I exit on blank cell? [email protected] Excel Programming 2 May 3rd 06 10:10 PM
Macro on exit cell nonshedders Excel Discussion (Misc queries) 1 April 12th 06 12:41 PM
If a called sub exit, how to the caller exit right away? luvgreen[_4_] Excel Programming 4 February 24th 04 05:06 PM


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