Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2008

Tip: Looking for answers? Try searching our database.

Determine if Carriage Return or Tab key is used

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
markb - 23 Jan 2008 21:31 GMT
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,
Signature

Markb

SeanC UK - 23 Jan 2008 22:31 GMT
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.
Signature

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

> 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
[quoted text clipped - 8 lines]
>
> Thanks,
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.