Print page based on the value of a cell

  • Thread starter Thread starter Michael Lanier
  • Start date Start date
M

Michael Lanier

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
 
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
 
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
 
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
 
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
 
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
(e-mail address removed). Remove the "extra" from this address. HTH
Otto
 
Back
Top