Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I change the direction when pressing ENTER? (dn, rt, etc.) | Excel Worksheet Functions | |||
Closing Form on pressing Enter or Return-key | Excel Programming | |||
How do i get figures for my maths. i am pressing enter return. | Excel Worksheet Functions | |||
WYA Converts to WAY after pressing enter ket | Excel Discussion (Misc queries) | |||
Pressing Enter Key | Setting up and Configuration of Excel |