enter key trigger

colleen

Board Regular
Joined
Feb 21, 2002
Messages
61
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
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
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!
 
Upvote 0
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
 
Upvote 0
DOes that mean that after entering the data i either have to press enter key or the arrow key to invoke the macro?
 
Upvote 0

Forum statistics

Threads
1,213,538
Messages
6,114,220
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top