ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Print page based on the value of a cell (https://www.excelbanter.com/excel-programming/434093-print-page-based-value-cell.html)

Michael Lanier

Print page based on the value of a cell
 
If cell A1=1 as the result of a change entry, I would like the page to
print. Is there a macro that will accomplish this? Thanks for any
help.

Michael

Otto Moehrbach[_2_]

Print page based on the value of a cell
 
The following macro will do that. I left the print command line for you to
fill because I have no idea what you want to print. This macro must be
placed in the sheet module of your sheet. You can access that module by
right-clicking on the sheet tab and selecting View Code. "X" out of the
module to return to your sheet. HTH Otto
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If Not Intersect(Target, Range("A1")) Is Nothing And _
Target = 1 Then
'place print code here
End If
End Sub

"Michael Lanier" wrote in message
...
If cell A1=1 as the result of a change entry, I would like the page to
print. Is there a macro that will accomplish this? Thanks for any
help.

Michael




Michael Lanier

Print page based on the value of a cell
 
Thanks Otto. Unfortunately, I have no idea how to write the print
code. The range to be printed is A1:N57, assuming the value of A1=1.
Does that help?

Michael

Otto Moehrbach[_2_]

Print page based on the value of a cell
 
Yes. The print command line would be:
Range("A1:N57").PrintOut
The macro I gave you will fire when a 1 is entered into cell A1. HTH Otto
"Michael Lanier" wrote in message
...
Thanks Otto. Unfortunately, I have no idea how to write the print
code. The range to be printed is A1:N57, assuming the value of A1=1.
Does that help?

Michael




Michael Lanier

Print page based on the value of a cell
 
Otto,

Thanks for your help. Unfortunately, the macro debugs and the
following is highlighted:

If Target.Count 1 Then

I entered the macro in Sheet1 which is the page to be printed. Do you
have any suggestions? Thanks.

Michael

Otto Moehrbach[_2_]

Print page based on the value of a cell
 
That line should be:
If Target.Count 1 Then Exit Sub
Do you have the whole line?
If you do have the whole line and it still gets that error, send me your
file. Change/delete the data if you wish. My email is
. Remove the "extra" from this address. HTH
Otto
"Michael Lanier" wrote in message
...
Otto,

Thanks for your help. Unfortunately, the macro debugs and the
following is highlighted:

If Target.Count 1 Then

I entered the macro in Sheet1 which is the page to be printed. Do you
have any suggestions? Thanks.

Michael





All times are GMT +1. The time now is 10:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com