How do I lock the header and footer in Excel?

I need assistance with Excel. It’s not every day that I have to lock headers and footers in my spreadsheets, so I’ve found myself a bit rusty on the process.

I’m currently working on a project where this feature is crucial, but I can’t seem to recall the exact steps to lock the header and footer sections in Excel securely.

I need the right steps to achieve and follow. Hope somebody can help



Locking headers and footers in Excel is a great way to maintain consistency in your document presentation.
Here’s a step-by-step guide to help you achieve this:

Access Header/Footer Settings:

  • Open your Excel workbook.
  • Navigate to the Page Layout tab on the Excel ribbon.
  • Click on Print Titles.

Setting up Header/Footer:

  • In the Page Setup dialog box that opens, switch to the Header/Footer tab.
  • Here, you can choose from predefined headers and footers or create a custom one by clicking on Custom Header or Custom Footer.

Designing Your Header/Footer:

  • In the custom design window, you can insert the desired text, page numbers, dates, and more.
  • Once you’ve designed your header and footer, click OK to save your settings.

Protecting Your Sheet:

  • To prevent others from editing the header and footer, you need to protect the sheet.
  • Go back to your Excel sheet, right-click on the sheet tab at the bottom, and select Protect Sheet.
  • In the Protect Sheet dialog box, you can set a password and select the actions you want to allow users to perform.
  • Make sure that the option Edit objects is unchecked to prevent changes to the header and footer.
  • Click OK to apply for the protection.


  • Once your sheet is protected, your header and footer are locked and cannot be edited without the password.
  • If you need to make changes to the header or footer later, you’ll need to unprotect the sheet using the set password.

Note: While Excel doesn’t have a specific feature to lock only the header and footer, sheet protection is the most effective way to prevent changes to these areas.

If you have any more questions or need further assistance, feel free to ask.



Locking headers and footers in Excel directly may not sound so straightforward since Excel’s protection features typically focus on cells within the sheet.

However, you can use VBA to restrict access to editing header and footer. Here’s a basic approach from me as well:

  1. Open VBA Editor: Press Alt + F11 to open the VBA Editor in Excel.
  2. Insert a New Module: In the VBA Editor, right-click on your workbook name in the “Project-VBAProject” pane and select Insert > Module.
  3. VBA Code to Protect Headers and Footers: Copy and paste the following code into the module:

Sub ProtectHeaderFooter()

' Protect the workbook structure

ThisWorkbook.Protect Structure:=True, Windows:=False

' Protect the worksheet and lock header/footer

ThisWorkbook.Sheets("YourSheetName").Protect Password:="YourPassword", _

AllowFormattingCells:=True, _

AllowFormattingColumns:=True, _

AllowFormattingRows:=True, _

AllowInsertingColumns:=True, _

AllowInsertingRows:=True, _

AllowInsertingHyperlinks:=True, _

AllowDeletingColumns:=True, _

AllowDeletingRows:=True, _

AllowSorting:=True, _

AllowFiltering:=True, _


End Sub

Replace “YourSheetName” with the actual name of your worksheet and “YourPassword” with a password of your choice.

  1. Run the Script: Run this script by pressing F5 or from the Run menu. This will protect your sheet and workbook structure, thus preventing changes to the header and footer.
  2. Editing the Sheet: To make changes to the header or footer after this, you’ll need to unprotect the sheet using the password you set in the code.

This method does not “lock” the header and footer in the traditional sense but prevents editing by protecting the entire sheet and workbook structure. Be cautious with using passwords in VBA, as they can be bypassed by someone with VBA knowledge.