Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Setting The Print Area
Hi, I'm quite new to the VBA side of excel, and i'm having a nightmare with this bit of code. What I want it to do is when you click print to set the print area to $A$2:$AZ$90 and then for it to print landscape on two sheets of paper, with the page break being at A54. I have been trying to do this for weeks now and have had so many different pieces of code etc I'm now left with this, which doesn't work at all : Code: -------------------- Private Sub Workbook_BeforePrint(Cancel As Boolean) 'turn off screen flickering Application.ScreenUpdating = False 'print procedure With ActiveSheet.PageSetup .PrintArea = "$A$2:$ay$90" .Orientation = xlLandscape .CenterHeader = "&U&26AV Bookings Week Commencing " & (Application.ActiveSheet.Name) .PrintHeadings = False .PrintGridlines = False .PrintComments = xlPrintNoComments .BlackAndWhite = False .PrintErrors = xlPrintErrorsDisplayed End With 'add in page break Set ActiveSheet.HPageBreaks(1).Location = Range("A54") 'turn off screen flickering Application.ScreenUpdating = True End Sub -------------------- If it helps I can send the Workbook which I'm using or anwser any questions. Please please please can anyone help!!!!!! Thanks Dave -- beans_21 ------------------------------------------------------------------------ beans_21's Profile: http://www.excelforum.com/member.php...o&userid=30281 View this thread: http://www.excelforum.com/showthread...hreadid=499519 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Setting The Print Area
Maybe...
Option Explicit Private Sub Workbook_BeforePrint(Cancel As Boolean) 'turn off screen flickering Application.ScreenUpdating = False 'print procedure With ActiveSheet.PageSetup .PrintArea = "$A$2:$az$90" .Orientation = xlLandscape .CenterHeader = "&U&26AV Bookings Week Commencing " & ActiveSheet.Name .PrintHeadings = False .PrintGridlines = False .PrintComments = xlPrintNoComments .BlackAndWhite = False .PrintErrors = xlPrintErrorsDisplayed End With 'add in page break ActiveSheet.HPageBreaks.Add _ Befo=ActiveSheet.Range("a54") 'turn off screen flickering Application.ScreenUpdating = True End Sub beans_21 wrote: Hi, I'm quite new to the VBA side of excel, and i'm having a nightmare with this bit of code. What I want it to do is when you click print to set the print area to $A$2:$AZ$90 and then for it to print landscape on two sheets of paper, with the page break being at A54. I have been trying to do this for weeks now and have had so many different pieces of code etc I'm now left with this, which doesn't work at all : Code: -------------------- Private Sub Workbook_BeforePrint(Cancel As Boolean) 'turn off screen flickering Application.ScreenUpdating = False 'print procedure With ActiveSheet.PageSetup .PrintArea = "$A$2:$ay$90" .Orientation = xlLandscape .CenterHeader = "&U&26AV Bookings Week Commencing " & (Application.ActiveSheet.Name) .PrintHeadings = False .PrintGridlines = False .PrintComments = xlPrintNoComments .BlackAndWhite = False .PrintErrors = xlPrintErrorsDisplayed End With 'add in page break Set ActiveSheet.HPageBreaks(1).Location = Range("A54") 'turn off screen flickering Application.ScreenUpdating = True End Sub -------------------- If it helps I can send the Workbook which I'm using or anwser any questions. Please please please can anyone help!!!!!! Thanks Dave -- beans_21 ------------------------------------------------------------------------ beans_21's Profile: http://www.excelforum.com/member.php...o&userid=30281 View this thread: http://www.excelforum.com/showthread...hreadid=499519 -- Dave Peterson |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Setting The Print Area
Thanks a lot the zoom tip was ace! Now works a treat! THANK YOU THANK YOU THANK YOU!!!!! :) :) :) :) :) :) :) -- beans_21 ------------------------------------------------------------------------ beans_21's Profile: http://www.excelforum.com/member.php...o&userid=30281 View this thread: http://www.excelforum.com/showthread...hreadid=499519 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Print Area Setting | Excel Discussion (Misc queries) | |||
Setting print area | Excel Discussion (Misc queries) | |||
setting a print area | Excel Programming | |||
setting print area via VBA | Excel Programming | |||
Setting print area | Excel Programming |