ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Button to print non-active page - How? (https://www.excelbanter.com/excel-programming/370941-button-print-non-active-page-how.html)

Bafa[_9_]

Button to print non-active page - How?
 

Private Sub CommandButton1_Click()
Worksheets("Print Data").PageSetup.PrintArea = "$A$1:$J$40"
End Sub

I did a search and tried to combine some results of what I found wit
bits and peices of what I have been learning. Can someone show me wha
I need to do here? Active wont work, because the page named "Prin
Data" that I want printed from my workbook is not active. And m
experiment of inserting "Worksheets("Print Data")" in its place didn'
work. So what should I use instead

--
Baf
-----------------------------------------------------------------------
Bafa's Profile: http://www.excelforum.com/member.php...fo&userid=3774
View this thread: http://www.excelforum.com/showthread.php?threadid=57362


Dan Hatola

Button to print non-active page - How?
 
The code you have just wsets the print area. It isn't actually telling the
computer to print anything. Try the PrintOut method. You can see all of the
details in the VBA help, but for the basics it should just be:

Worksheets("Print Data").PrintOut

Dan

"Bafa" wrote:


Private Sub CommandButton1_Click()
Worksheets("Print Data").PageSetup.PrintArea = "$A$1:$J$40"
End Sub

I did a search and tried to combine some results of what I found with
bits and peices of what I have been learning. Can someone show me what
I need to do here? Active wont work, because the page named "Print
Data" that I want printed from my workbook is not active. And my
experiment of inserting "Worksheets("Print Data")" in its place didn't
work. So what should I use instead?


--
Bafa
------------------------------------------------------------------------
Bafa's Profile: http://www.excelforum.com/member.php...o&userid=37748
View this thread: http://www.excelforum.com/showthread...hreadid=573626



jb

Button to print non-active page - How?
 
You might try;

Sub PRINT_DATA()
Sheets("CHART_DATA").Select
Range("A1:Q57").Select
ActiveSheet.PageSetup.PrintArea = "$A$1:$S$57"
dlgprintr = Application.Dialogs(xlDialogPrint).Show ' POPUP PRINT DIALOG
BOX
End Sub

"Bafa" wrote in message
...

Private Sub CommandButton1_Click()
Worksheets("Print Data").PageSetup.PrintArea = "$A$1:$J$40"
End Sub

I did a search and tried to combine some results of what I found with
bits and peices of what I have been learning. Can someone show me what
I need to do here? Active wont work, because the page named "Print
Data" that I want printed from my workbook is not active. And my
experiment of inserting "Worksheets("Print Data")" in its place didn't
work. So what should I use instead?


--
Bafa
------------------------------------------------------------------------
Bafa's Profile:
http://www.excelforum.com/member.php...o&userid=37748
View this thread: http://www.excelforum.com/showthread...hreadid=573626




Dave Peterson

Button to print non-active page - How?
 
Your code only changes the printarea. It doesn't actually print anything:

Private Sub CommandButton1_Click()
Worksheets("Print Data").PageSetup.PrintArea = "$A$1:$J$40"
Worksheets("Print Data").Printout
End Sub

Bafa wrote:

Private Sub CommandButton1_Click()
Worksheets("Print Data").PageSetup.PrintArea = "$A$1:$J$40"
End Sub

I did a search and tried to combine some results of what I found with
bits and peices of what I have been learning. Can someone show me what
I need to do here? Active wont work, because the page named "Print
Data" that I want printed from my workbook is not active. And my
experiment of inserting "Worksheets("Print Data")" in its place didn't
work. So what should I use instead?

--
Bafa
------------------------------------------------------------------------
Bafa's Profile: http://www.excelforum.com/member.php...o&userid=37748
View this thread: http://www.excelforum.com/showthread...hreadid=573626


--

Dave Peterson

Bafa[_10_]

Button to print non-active page - How?
 

Well I am glad to see I at least figured out half of the code. Thank
again

--
Baf
-----------------------------------------------------------------------
Bafa's Profile: http://www.excelforum.com/member.php...fo&userid=3774
View this thread: http://www.excelforum.com/showthread.php?threadid=57362



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

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