Page Break Macro

cadence

Well-known Member
Joined
Dec 6, 2005
Messages
528
Hello all the Macro below Sets a defined range of Paqge breaks before a user goes to print priview or print. It deos this so no matter what the user does the page will always print as ther are intended to.

My problem is this works fine on a mac. when I brought it over to a PC environment it it give me a 'Run-time error 1004'


Code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
    ActiveSheet.PageSetup.LeftFooter = Range("Budget!$B$5").Value & Range("'DropList'!$AI$3").Value
            If ActiveSheet.Name = "Budget" Then
                ActiveWorkbook.Sheets("Budget").PageSetup.PrintArea = "$A$1:$L$67,$M$3:$AE$70,$AF$3:$EN$69"
                Set ActiveSheet.VPageBreaks(1).Location = Range("U3")
                Set ActiveSheet.VPageBreaks(2).Location = Range("AX3")
                Set ActiveSheet.VPageBreaks(3).Location = Range("BQ3")
                Set ActiveSheet.VPageBreaks(4).Location = Range("CJ3")
                Set ActiveSheet.VPageBreaks(5).Location = Range("DC3")
                Set ActiveSheet.VPageBreaks(6).Location = Range("DW3")
                ElseIf ActiveSheet.Name = "Casting Estimate" Then
                    ActiveWorkbook.Sheets("Casting Estimate").PageSetup.PrintArea = "$A$1:$N$70,$O$3:$AG$74"
                Else
            End If
        With ActiveSheet.PageSetup
            .Zoom = 75
        End With
    'Application.Dialogs(xlDialogPrint).Show
    'ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End Sub

PS I have also posted another problem regarding Cells changing Colour.

I would dearly love to make this a cross platform file. Any suggestions?

much appreciated.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Forum statistics

Threads
1,213,484
Messages
6,113,927
Members
448,533
Latest member
thietbibeboiwasaco

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