PC Review


Reply
Thread Tools Rate Thread

Determine if Carriage Return or Tab key is used

 
 
markb
Guest
Posts: n/a
 
      23rd Jan 2008
I need to show a message box if the user enters an "N" in any particular
cell. I currently have code in the SelectionChange procedure, which checks to
see if the cell direcly above or to the left of the active cell has the "N".
This causes a problem because if a user is entering information on the next
line, when the active cell is direcly below a cell with only an "N", it shows
the message box. So, I am wanting to write a procedure that is triggered when
the user hits either Enter or Tab to check if the last active cell has only
an "N".

Please help if you can.

Thanks,
--
Markb
 
Reply With Quote
 
 
 
 
SeanC UK
Guest
Posts: n/a
 
      23rd Jan 2008
Hi Mark,

Using the Worksheet_SelectionChange event passes the newly selected range as
Target. If you want to check the last cell that had data entered then try
using the Worksheet_Change event to trigger your code. This passes the range
of the changed cell. Also this only happens when cell contents are changed,
whereas the SelectionChange event occurs after every new selection, and
therefore will be triggering your code far more often.

If this isn't quite what you were looking for then let me know and I'll try
to help further.

Cheers,

Sean.
--
(please remember to click yes if replies you receive are helpful to you)


"markb" wrote:

> I need to show a message box if the user enters an "N" in any particular
> cell. I currently have code in the SelectionChange procedure, which checks to
> see if the cell direcly above or to the left of the active cell has the "N".
> This causes a problem because if a user is entering information on the next
> line, when the active cell is direcly below a cell with only an "N", it shows
> the message box. So, I am wanting to write a procedure that is triggered when
> the user hits either Enter or Tab to check if the last active cell has only
> an "N".
>
> Please help if you can.
>
> Thanks,
> --
> Markb

 
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
Adding a Hard Return or carriage return in an update query? Lakota2k Microsoft Access Queries 1 15th Sep 2008 04:56 AM
Search and replace hard-line-return character, not carriage return =?Utf-8?B?VHlsZXIgVA==?= Microsoft Word Document Management 2 16th Aug 2006 09:11 PM
Carriage Return PR Microsoft Access Queries 5 7th Nov 2005 04:12 AM
Userenv 1000. Windows cannot determine the user or computer name. Return value (<return error code>). Ingmar Microsoft Windows 2000 Networking 1 18th Nov 2003 05:08 PM
Userenv 1000. Windows cannot determine the user or computer name. Return value (<return error code>). Ingmar Microsoft Windows 2000 Group Policy 1 18th Nov 2003 05:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:48 PM.