Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Printing from a control button | Excel Programming | |||
Printing Control | Excel Programming | |||
Get Control Before AND After Printing | Excel Programming | |||
Get Control Before AND After Printing | Excel Programming | |||
My spreadsheet has a control box. box moves after printing. Why? | Excel Discussion (Misc queries) |