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

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
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,494
Messages
6,113,974
Members
448,537
Latest member
Et_Cetera

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