Consulting

Results 1 to 2 of 2

Thread: Cell Values in Header

  1. #1
    VBAX Newbie
    Joined
    Mar 2012
    Posts
    1
    Location

    Cell Values in Header

    This bit of code displays a cell value in the header for each page

    Sub UpdateHeader()
    ActiveSheet.PageSetup.Leftheader = Range("A1").Value
    End Sub


    I would like to change it to have a different header on each page eg:
    page 1 = A1
    page 2 = A2
    page 3 = A3 etc

    Does anyone know if this is possible?

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    You could change it as you print
    [VBA]Sub UpdateHeader()
    For i = 1 To 3
    ActiveSheet.PageSetup.LeftHeader = Cells(1, i).Value
    ActiveWindow.SelectedSheets.PrintOut From:=i, To:=i
    Next
    End Sub[/VBA]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

Posting Permissions

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