![]() |
Cursor movement
Hi
I run a sheet change macro when a value changes in a cell. What I would like to control is where the cursor goes after the macro has finished. For example, if after entering a value in a cell and I then press the right arrow key, I would like the cursor to go right. Is this possible ? TIA Andrew Bourke |
Cursor movement
Does this help? ..offset(,1).select -- Don Guillett Microsoft MVP Excel SalesAid Software "Andrew Bourke" wrote in message ... Hi I run a sheet change macro when a value changes in a cell. What I would like to control is where the cursor goes after the macro has finished. For example, if after entering a value in a cell and I then press the right arrow key, I would like the cursor to go right. Is this possible ? TIA Andrew Bourke |
Cursor movement
On 25/01/2009 8:45 AM, Don Guillett wrote:
Does this help? .offset(,1).select Thanks for your reply, I can see what this does but it is not quite what I needed. Data is entered into a cell and sometimes the user presses enter to go down, or the right arrow key to go across. I need to know which is which so I can make the next active cell the appropriate one. TIA |
Cursor movement
Private Sub Worksheet_Change(ByVal Target As Range)
Target.Offset(, 1).Select End Sub Probably is what you want to do. When user changes Target and presses enter or arrow or selects any other cell, this code would run and select the cell to the right. -- Regards, Anant "Andrew Bourke" wrote: On 25/01/2009 8:45 AM, Don Guillett wrote: Does this help? .offset(,1).select Thanks for your reply, I can see what this does but it is not quite what I needed. Data is entered into a cell and sometimes the user presses enter to go down, or the right arrow key to go across. I need to know which is which so I can make the next active cell the appropriate one. TIA |
Cursor movement
Hi
I have almost found what I need by inserting: Application.Onkey "{RIGHT}", "RightArrowKeyPressed" The sub RightArrowKeyPressed stores a value in a temp cell to tell me the right arrow key has been pressed. Before I exit the main routine I check for this temp value - empty and the cursor is moved down, non empty and the cursor moves right. The only issue I have now is that it doesn't seem to work on the first instance. On 25/01/2009 5:38 PM, Anant Basant wrote: Private Sub Worksheet_Change(ByVal Target As Range) Target.Offset(, 1).Select End Sub Probably is what you want to do. When user changes Target and presses enter or arrow or selects any other cell, this code would run and select the cell to the right. |
All times are GMT +1. The time now is 08:16 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com