![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Posts: 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
|
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Mar 2002
Location: London, UK
Posts: 167
|
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 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
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 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
I must be reading Daley's mind?
|
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Feb 2002
Posts: 61
|
DOes that mean that after entering the data i either have to press enter key or the arrow key to invoke the macro?
|
|
|
|
|
|
#6 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
Yes
|
|
|
|
|
|
#7 |
|
Board Regular
Join Date: Feb 2002
Posts: 61
|
thanks a lot for your help to both of you..colleen
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|