Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 7 of 7

Thread: enter key trigger

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Posts
    61
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I have a spread sheet which after entering data in cell f15, I press the print button. Is there a way where after entering data in this cell and pressing "enter" key it sends the page to the printer...Thanks colleen

  2. #2
    Board Regular
    Join Date
    Mar 2002
    Location
    London, UK
    Posts
    167
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Go into the visual basic editor, and double click on the sheet you want this to work for, which will bring up the code module for that sheet. Paste in the following code...


    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$F$15" Then ActiveWindow.SelectedSheets.PrintOut copies:=1
    End Sub



    Good luck!

    <table style="background-color:#0e54be" cellspacing="1" cellpadding="2"><td style="background-color:#ceffff;font-family:arial;color:#072c63;font-size:8pt;"> DALEY :P </td></table>

  3. #3
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi
    I do not understand the increase in convenience for the complications involved in performing what you wish.
    Maybe this can help you...

    If, at every change of value in cell F15, you wish to print with a keypress instead of a click, place this in your worksheet change event:

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Address = "$F$15" Then ActiveSheet.PrintOut
    End Sub

    This will printout regardless of which key you press after entering your data.
    If you insist on using enter only then repost and I will find the API function to respond to system-wide keyboard events.
    As far as I know, there is no other way to detect a specific keypress in a worksheet.

    Tom

  4. #4
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I must be reading Daley's mind?

  5. #5
    Board Regular
    Join Date
    Feb 2002
    Posts
    61
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    DOes that mean that after entering the data i either have to press enter key or the arrow key to invoke the macro?

  6. #6
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Yes

  7. #7
    Board Regular
    Join Date
    Feb 2002
    Posts
    61
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    thanks a lot for your help to both of you..colleen

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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