Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 279
Default Capture ENTER

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Capture 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]


  #3   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 279
Default Capture ENTER

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Capture ENTER

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
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
Macro to select cells in column enter data then press enter NP New Users to Excel 1 February 20th 08 04:21 PM
Excel screen capture to capture cells and row and column headings jayray Excel Discussion (Misc queries) 5 November 2nd 07 11:01 PM
Enter multiple numbers in a cell so total shows when enter keypres newbie Excel Worksheet Functions 2 August 19th 07 12:23 PM
Enter info in one sheet, auto enter in another based on one field The BusyHighLighter[_2_] New Users to Excel 1 August 1st 07 10:54 PM
how to capture enter key inside a cell helpwithXL Excel Programming 3 April 1st 05 03:54 PM


All times are GMT +1. The time now is 03:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"