+ Reply to Thread
Results 1 to 4 of 4

Capture ENTER

  1. #1
    Ed
    Guest

    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. #2
    Jake Marx
    Guest

    Re: 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. #3
    Ed
    Guest

    Re: 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. #4
    Jake Marx
    Guest

    Re: 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1