Site Map
menu 1
menu 2
menu 3
menu 4
menu 5
menu 6
 
Onsite Training
Since 2003, iCellini Computer Training has been San Diego's number one choice for onsite computer training.

How to Print a Multi-page Worksheet without Printing the Header on the First Page

(page 2 of 2)

Open a blank workbook or any workbook. Press Alt + F11 to open the Visual Basic Editor.

In the Projects pane on the upper left, find the Personal.xls file and click the plus sign beside the Modules folder, and then double-click Module 1.

Project Panel

Your project panel will probably have different files, but just isolate on the VBAProject (PERSONAL.XLS) and it's Module1 in the Modules folder. Double-clicking Module 1 will open it's code window where we will paste our code.

Code Window

You will copy and paste the code below into the code window. If there is no other code in the window, then just paste the code below Option Explicit. You are likely to have some code already stored in the module. Notice that the procedures begin with Sub or Public Sub and end with End Sub. If there is code already in the code window, just paste your code where all the other code ends. Here is the code you need to copy and paste (if you are using Internet Explorer and have difficulty selecting the following code, copy the code from this text file):

Sub NoFirstPageHeader_AllSheets()
    Dim wsSheet As Worksheet
    Dim strLeft As String
    Dim strRight As String
    Dim strCenter As String

    For Each wsSheet In Worksheets
        With wsSheet
            strLeft = .PageSetup.LeftHeader
            .PageSetup.LeftHeader = ""
            strCenter = .PageSetup.CenterHeader
            .PageSetup.CenterHeader = ""
            strRight = .PageSetup.RightHeader
            .PageSetup.RightHeader = ""
            .PrintOut From:=1, To:=1
            .PageSetup.LeftHeader = strLeft
            .PageSetup.CenterHeader = strCenter
            .PageSetup.RightHeader = strRight
            .PrintOut From:=2
        End With
    Next wsSheet
End Sub

Close the Visual Basic Editor. You now have added a macro to your Personal Macro Workbook. If you open the Macro dialog box (Tools --> Macro --> Macros), you will see it listed. You can now create a toolbar button or menu item to run your macro.

page 1 | 2 | return to Resources page >>