![]() |
Control printing?
Our daily spreadsheet template contains 10 printable pages. Each
page contains 5 rows of header information and 25 rows for data entry. (In other words, one page equals 30 rows). Users will typically fill up anywhere between 0-6 pages per day. Here's my problem: Whenever a user presses 'Print' (or even Ctrl-P), Excel will automatically print all 10 pages. This will often waste paper, because what if a user only fills up 2 pages with data? That means the remaining 8 empty pages get printed as well. So, if a user presses 'Print' or Ctrl-P, how can I tell Excel to only print the pages that contain data? Thanks! |
Control printing?
Hi Robert,
Am Fri, 25 Jan 2013 11:54:27 -0700 schrieb Robert Crandal: Whenever a user presses 'Print' (or even Ctrl-P), Excel will automatically print all 10 pages. This will often waste paper, because what if a user only fills up 2 pages with data? That means the remaining 8 empty pages get printed as well. set print area new for each print job: Private Sub Workbook_BeforePrint(Cancel As Boolean) Dim LRow As Long Dim LCol As Integer With ActiveSheet LRow = .Cells(.Rows.Count, 1).End(xlUp).Row LCol = .Cells(1, .Columns.Count).End(xlToLeft).Column With .PageSetup .PrintArea = "" .PrintArea = "$A$1:" & Cells(LRow, LCol).Address End With End With End Sub Regards Claus Busch -- Win XP PRof SP2 / Vista Ultimate SP2 Office 2003 SP2 /2007 Ultimate SP2 |
Control printing?
Cool, so the basic idea is to process "Workbook_BeforePrint()"
and set the page setup ".PrintArea". Thank you Claus! 8) "Claus Busch" wrote in message ... Hi Robert, Am Fri, 25 Jan 2013 11:54:27 -0700 schrieb Robert Crandal: Whenever a user presses 'Print' (or even Ctrl-P), Excel will automatically print all 10 pages. This will often waste paper, because what if a user only fills up 2 pages with data? That means the remaining 8 empty pages get printed as well. set print area new for each print job: Private Sub Workbook_BeforePrint(Cancel As Boolean) Dim LRow As Long Dim LCol As Integer With ActiveSheet LRow = .Cells(.Rows.Count, 1).End(xlUp).Row LCol = .Cells(1, .Columns.Count).End(xlToLeft).Column With .PageSetup .PrintArea = "" .PrintArea = "$A$1:" & Cells(LRow, LCol).Address End With End With End Sub Regards Claus Busch -- Win XP PRof SP2 / Vista Ultimate SP2 Office 2003 SP2 /2007 Ultimate SP2 |
All times are GMT +1. The time now is 08:36 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com