PC Review


Reply
Thread Tools Rate Thread

Before Cell Exit

 
 
Brad
Guest
Posts: n/a
 
      13th May 2010
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 With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      13th May 2010
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
 
Reply With Quote
 
ryguy7272
Guest
Posts: n/a
 
      13th May 2010
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't exit cell being edited =?Utf-8?B?RGFuRw==?= Microsoft Excel Crashes 0 14th Nov 2007 03:40 PM
change cell on exit vba Joost Microsoft Excel Programming 6 12th Jun 2007 02:00 PM
How do I exit on blank cell? vicleong@gmail.com Microsoft Excel Programming 2 3rd May 2006 10:10 PM
How to move to 1st cell in next row after exit a particular cell. =?Utf-8?B?V2luZDU0U3VyZmVy?= Microsoft Excel Programming 4 17th Apr 2006 11:39 PM
Run Macro on cell exit Kelly Microsoft Excel Programming 7 5th May 2004 09:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:58 AM.