picklefactory
Well-known Member
- Joined
- Jan 28, 2005
- Messages
- 508
- Office Version
- 365
- Platform
- 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
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