Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have some code in Worksheet_SelectionChange (ByVal Target As Range)
I want to redirect the activecell to another place when the user hits ENTER (actually would like it to move the focus to my combobox). I am not able (or don't understand) how to accomplish this. I have tried the Target = 13 in other places in my code with comboboxes and keydown and it works, but it doesn't work in this sub. Any suggestions? -- Thanks - Ed |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Ed,
Ed wrote: I have some code in Worksheet_SelectionChange (ByVal Target As Range) I want to redirect the activecell to another place when the user hits ENTER (actually would like it to move the focus to my combobox). I am not able (or don't understand) how to accomplish this. I have tried the Target = 13 in other places in my code with comboboxes and keydown and it works, but it doesn't work in this sub. Any suggestions? The SelectionChange event will fire when the user's selection changes from one cell or range to another. The Target argument is a Range object that references the newly-selected range. So I don't think you need to trap the Enter key - I think you could just trap the event and move to your ComboBox based on the new selection. -- Regards, Jake Marx www.longhead.com [please keep replies in the newsgroup - email address unmonitored] |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I actually want two different things to happen. If the user uses TAB, he
should move to the next cell. If he hits ENTER, I want him to move back to the first column and activate the combobox. This is why I wanted to capture the ENTER. -- Thanks - Ed "Jake Marx" wrote: Hi Ed, Ed wrote: I have some code in Worksheet_SelectionChange (ByVal Target As Range) I want to redirect the activecell to another place when the user hits ENTER (actually would like it to move the focus to my combobox). I am not able (or don't understand) how to accomplish this. I have tried the Target = 13 in other places in my code with comboboxes and keydown and it works, but it doesn't work in this sub. Any suggestions? The SelectionChange event will fire when the user's selection changes from one cell or range to another. The Target argument is a Range object that references the newly-selected range. So I don't think you need to trap the Enter key - I think you could just trap the event and move to your ComboBox based on the new selection. -- Regards, Jake Marx www.longhead.com [please keep replies in the newsgroup - email address unmonitored] |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ed,
OK - I think you'll have to use Application.OnKey then. The worksheet object doesn't expose any type of keyboard events that you can trap. '/ this maps Enter key to subroutine named "test" Application.OnKey "{ENTER}", "test" '/ use {RETURN} for Return key '/ this unmaps Enter key Application.OnKey "{ENTER}" -- Regards, Jake Marx www.longhead.com [please keep replies in the newsgroup - email address unmonitored] Ed wrote: I actually want two different things to happen. If the user uses TAB, he should move to the next cell. If he hits ENTER, I want him to move back to the first column and activate the combobox. This is why I wanted to capture the ENTER. Hi Ed, Ed wrote: I have some code in Worksheet_SelectionChange (ByVal Target As Range) I want to redirect the activecell to another place when the user hits ENTER (actually would like it to move the focus to my combobox). I am not able (or don't understand) how to accomplish this. I have tried the Target = 13 in other places in my code with comboboxes and keydown and it works, but it doesn't work in this sub. Any suggestions? The SelectionChange event will fire when the user's selection changes from one cell or range to another. The Target argument is a Range object that references the newly-selected range. So I don't think you need to trap the Enter key - I think you could just trap the event and move to your ComboBox based on the new selection. -- Regards, Jake Marx www.longhead.com [please keep replies in the newsgroup - email address unmonitored] |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to select cells in column enter data then press enter | New Users to Excel | |||
Excel screen capture to capture cells and row and column headings | Excel Discussion (Misc queries) | |||
Enter multiple numbers in a cell so total shows when enter keypres | Excel Worksheet Functions | |||
Enter info in one sheet, auto enter in another based on one field | New Users to Excel | |||
how to capture enter key inside a cell | Excel Programming |