Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Mar 2004
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SUPPRESS HEADER (EXCEL 03)

    HI,

    I have a worksheet with this header:

    CenterHeader = reportname

    What should I do if I wanted show in right header the total number of lines in the report minus one. Also, I wanted to show the center and right header on the first page only, and the rest of the pages with the center header only.

    Thank you in advance for your inputs.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: SUPPRESS HEADER (EXCEL 03)

    Excel uses the same headers and footers in all pages of a worksheet. Unlike in Word, you cannot specify a different header for the first page.

    You'd need VBA code to set the right header to display the number of lines. If you want help with that, we'd need to know how we can determine the number of lines. Is column A always populated, for example?

  3. #3
    Lounger
    Join Date
    Mar 2004
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SUPPRESS HEADER (EXCEL 03)

    First of all thank you for responding.

    Yes, column A is always populated. All I need is the total number of populated rows minus 1 which is the column header.

    Thanks again.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: SUPPRESS HEADER (EXCEL 03)

    You could use code like this in the Before Print event procedure of the workbook. It MUST go into the ThisWorkbook module, not in a standard module.
    <code>
    Private Sub Workbook_BeforePrint(Cancel As Boolean)
    With Worksheets("Sheet1")
    .PageSetup.RightHeader = (.Range("A65536").End(xlUp).Row - 1) & " records"
    End If
    End Sub
    </code>
    Replace Sheet1 with the name of the worksheet.

  5. #5
    Lounger
    Join Date
    Mar 2004
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: SUPPRESS HEADER (EXCEL 03)

    Thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •