Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default Where was I before pressing enter/return or tab key

I am using Excel 2007

Is there a way to tell where I was (cell or row/column) before I
pressed the enter/return or used the tab key ?

I have a requirement to move a row of data from one sheet to another
if the status cell is changed to Green. I can get the correct row if
the value is selected from a validation list (using the
Worksheet_Change event), but if I type in the value and press enter/
tab key or click away using the mouse then the wrong row is selected.

Thanks for any suggestions
Fred
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 203
Default Where was I before pressing enter/return or tab key

"Fred" wrote in message
...
I am using Excel 2007

Is there a way to tell where I was (cell or row/column) before I
pressed the enter/return or used the tab key ?

I have a requirement to move a row of data from one sheet to another
if the status cell is changed to Green. I can get the correct row if
the value is selected from a validation list (using the
Worksheet_Change event), but if I type in the value and press enter/
tab key or click away using the mouse then the wrong row is selected.

Thanks for any suggestions
Fred



Perhaps adding something like this to your Worksheet module will give
you what you need:

Option Explicit

Dim LastActiveSelection As Range
Dim SelectionBeforeLast As Range


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Set SelectionBeforeLast = LastActiveSelection
Set LastActiveSelection = Target
End Sub

Then both of these variables would also be available to your
Worksheet_Change procedure.

--
Clif McIrvin

(clare reads his mail with moe, nomail feeds the bit bucket :-)


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
How do I change the direction when pressing ENTER? (dn, rt, etc.) CGN Bear Excel Worksheet Functions 3 July 15th 09 06:29 PM
Closing Form on pressing Enter or Return-key [email protected] Excel Programming 2 October 11th 07 11:57 AM
How do i get figures for my maths. i am pressing enter return. [email protected] Excel Worksheet Functions 1 April 3rd 07 12:32 PM
WYA Converts to WAY after pressing enter ket Roger Cookson Excel Discussion (Misc queries) 3 December 16th 05 05:24 PM
Pressing Enter Key Yo Setting up and Configuration of Excel 4 October 28th 05 10:59 PM


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

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"