Capturing ENTER keypress 
Author Message
 Capturing ENTER keypress

I have this need to write a macro where I need the cursor to move one cell
to the right every time the ENTER key is pressed during data entry
operations.  I know that OFFSET is the function to move the cursor around
but how do I trap an ENTER keypress in Excel 5?  Any help would be greatly
appreciated.

Thanks,

Manny



Thu, 02 Sep 1999 03:00:00 GMT  
 Capturing ENTER keypress

Try the OnKey method - you can assign a procedure to the enter key.  Just
remeber to set it back to normal function at the end of the macro!

Cheers,
Trina



Quote:
> I have this need to write a macro where I need the cursor to move one
cell
> to the right every time the ENTER key is pressed during data entry
> operations.  I know that OFFSET is the function to move the cursor around
> but how do I trap an ENTER keypress in Excel 5?  Any help would be
greatly
> appreciated.

> Thanks,

> Manny



Thu, 02 Sep 1999 03:00:00 GMT  
 Capturing ENTER keypress

Hi Many,

Try these procedures:

'set up the onkey events
Sub SetOnKey()
    With Application
        .OnKey "~", "MoveOverRight"  'enter key
        .OnKey "{ENTER}", "MoveOverRight"  'keypad enter
        .OnKey "{ESC}", "EndOnKey" 'ESC key (ends the onkey events)
    End With
End Sub

Sub MoveOverRight()
    On Error Resume Next 'keep going if 1). Not a worksheet, 2). Can't move
over anymore
    ActiveCell.Offset(0, 1).Select
End Sub

'reset the keys to their normal settings
Sub EndOnKey()
    With Application
        .OnKey "~"
        .OnKey "{ENTER}"
        .OnKey "{ESC}"
    End With
End Sub

Hope this helps,

--
Mike Chidsey

You can have everything in life you
want if you will just help enough other
people get what they want.
           -Zig Ziglar



Quote:
> I have this need to write a macro where I need the cursor to move one
cell
> to the right every time the ENTER key is pressed during data entry
> operations.  I know that OFFSET is the function to move the cursor around
> but how do I trap an ENTER keypress in Excel 5?  Any help would be
greatly
> appreciated.

> Thanks,

> Manny



Fri, 03 Sep 1999 03:00:00 GMT  
 Capturing ENTER keypress

In Excel 7.0 you can set the option using Tools|Options|Edit
I think there is a similar feature in Excel 5.0

--
Dan Sonnen



Quote:
> I have this need to write a macro where I need the cursor to move one
cell
> to the right every time the ENTER key is pressed during data entry
> operations.  I know that OFFSET is the function to move the cursor around
> but how do I trap an ENTER keypress in Excel 5?  Any help would be
greatly
> appreciated.

> Thanks,

> Manny



Sat, 04 Sep 1999 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Capturing Entered By/Entered Date

2. Capture keypress

3. Capturing Keypress from Toolbar

4. capturing keypress prevents reading field value

5. how to capture keyPress event from invisible PowerPoint forms

6. how to capture keyPress event from invisible PowerPoint forms

7. Capturing a keypress in a document?

8. KeyPress Event and Enter key

9. Combobox.KeyPress does not react to Enter

10. Enter key not triggering ActiveX ctl KeyPress event


 
Powered by phpBB® Forum Software © phpBB Group