Print layout VBA problem

picklefactory

Well-known Member
Joined
Jan 28, 2005
Messages
508
Office Version
  1. 365
Platform
  1. Windows
Hello folks, hope someone can see what I can't, gone code blind I think.
I have the enclosed code to hide some areas and set print margins on a multifunction sheet. It was working fine until I decided to add an extra column of cells to the sheet concerned and adjust code below accordingly. My issue is that instead of it setting print area to cells $B$10:$O$783, as requested, I am only getting cells $B$10:$N$783.
I have another sub similar to this which hides/selects different areas which altered without any issue to accomodate the new column. Can anyone see what I'm missing.
Cheers


Sub ManLayout()
'
' Manufacturing Layout Code
' 30/06/2006 J. Loftus
'
Columns("A:X").EntireColumn.Hidden = False
Rows("1:14").EntireRow.Hidden = False
Rows("2:9").EntireRow.Hidden = True
Columns("P:X").EntireColumn.Hidden = True
ActiveWindow.View = xlPageBreakPreview
ActiveSheet.PageSetup.PrintArea = "$B$10:$O$783"
ActiveSheet.ResetAllPageBreaks
Set ActiveSheet.HPageBreaks(1).Location = Range("B80")
Set ActiveSheet.HPageBreaks(2).Location = Range("B144")
Set ActiveSheet.HPageBreaks(3).Location = Range("B208")
Set ActiveSheet.HPageBreaks(4).Location = Range("B272")
Set ActiveSheet.HPageBreaks(5).Location = Range("B336")
Set ActiveSheet.HPageBreaks(6).Location = Range("B400")
Set ActiveSheet.HPageBreaks(7).Location = Range("B464")
Set ActiveSheet.HPageBreaks(8).Location = Range("B528")
Set ActiveSheet.HPageBreaks(9).Location = Range("B592")
Set ActiveSheet.HPageBreaks(10).Location = Range("B656")
Set ActiveSheet.HPageBreaks(11).Location = Range("B720")
With ActiveSheet.PageSetup
.Orientation = xlPortrait
.LeftMargin = Application.InchesToPoints(0)
.RightMargin = Application.InchesToPoints(0)
.TopMargin = Application.InchesToPoints(0)
.BottomMargin = Application.InchesToPoints(0.393700787401575)
.HeaderMargin = Application.InchesToPoints(0)
.FooterMargin = Application.InchesToPoints(0)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = True
.CenterVertically = True
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 75
End With
ActiveWindow.View = xlNormalView
Range("E16").Select
End Sub
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Sorry, sussed it. Because I'd added more info I had to decrease the zoom to 70% from 75. Damned thing just woudn't fit at that zoom.
Thanks for looking Andrew.
 
Upvote 0

Forum statistics

Threads
1,222,072
Messages
6,163,751
Members
451,855
Latest member
mcook36155

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top