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 |
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 :-) |
All times are GMT +1. The time now is 04:36 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com