Copper Contributor

I have multiple sheets and would like to have different headers for each sheet. 

1 Reply


To have different headers for each sheet in Excel, you can utilize the built-in header and footer functionality. Here's how you can set different headers for each sheet:

  1. Manually Setting Headers:
    • Go to each sheet where you want to set a different header.
    • Double-click on the header area (the top section of the worksheet) to enter the header editing mode.
    • Enter the desired header text or insert elements such as page numbers, date, time, etc.
    • Press Enter or click outside the header area to apply the changes.
  2. Using VBA to Set Headers: If you have many sheets and want to automate the process, you can use VBA. Here's an example VBA code that sets different headers for each sheet:

Vba code is untested, please backup your file.

Sub SetDifferentHeaders()
    Dim ws As Worksheet
    Dim headerText As String
    For Each ws In ThisWorkbook.Sheets
        Select Case ws.Name
            Case "Sheet1"
                headerText = "Header for Sheet 1"
            Case "Sheet2"
                headerText = "Header for Sheet 2"
            ' Add more cases for each sheet
            Case Else
                headerText = "Default Header"
        End Select
        ' Set the header text for the current sheet
        ws.PageSetup.CenterHeader = headerText
    Next ws
End Sub
  • This code loops through each sheet in the workbook and sets a different header based on the sheet's name.
  • Modify the Select Case block to specify the header text for each sheet.
  • You can customize the header text and formatting as needed.

3. Using Excel Formulas: You can also use formulas to dynamically generate headers based on certain criteria or data within the sheet. However, this approach may not provide the same level of flexibility and customization as using VBA.

Choose the method that best suits your needs and workflow.

If you are using Excel Online, the capabilities for setting different headers for each sheet are more limited compared to the desktop version of Excel. Currently, Excel Online does not provide native support for setting different headers for each sheet. The text was created with the help of AI.


My answers are voluntary and without guarantee!


Hope this will help you.


Was the answer useful? Mark as best response and like it!

This will help all forum participants.