ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Can I print different areas of a spreadsheet using CommandButtons (https://www.excelbanter.com/excel-discussion-misc-queries/183703-can-i-print-different-areas-spreadsheet-using-commandbuttons.html)

Guy B Machan

Can I print different areas of a spreadsheet using CommandButtons
 
I would like to set up a workbook with the first spreadsheet containing a
series of commandbuttons, set into a calendar, that enables the user to print
out information contained in other spreadsheets.
I can set up the commandbutton to do this for one spreadsheet but as there
will be many different prints this would mean many different spreadsheets.
I wanted to know that if I created several named areas in one spreadsheet
whether I could get the commandbutton to print off a named area using the
commandbutton macro. Or is there another solution?

Jon Peltier

Can I print different areas of a spreadsheet using CommandButtons
 
Call this routine for each name on each sheet:

Sub PrintNamedRange(sSheet As String, sRange As String)
Worksheets(sSheet).Range(sRange).Name = "'" & sSheet & "'!Print_Area"
Worksheets(sSheet).PrintOut
End Sub

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Guy B Machan" <Guy B wrote in message
...
I would like to set up a workbook with the first spreadsheet containing a
series of commandbuttons, set into a calendar, that enables the user to
print
out information contained in other spreadsheets.
I can set up the commandbutton to do this for one spreadsheet but as there
will be many different prints this would mean many different spreadsheets.
I wanted to know that if I created several named areas in one spreadsheet
whether I could get the commandbutton to print off a named area using the
commandbutton macro. Or is there another solution?





All times are GMT +1. The time now is 01:22 PM.

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