
- MS Excel Basics
- Excel - Home
- Excel - Getting Started
- Excel - Explore Window
- Excel - Backstage
- Excel - Entering Values
- Excel - Move Around
- Excel - Save Workbook
- Excel - Create Worksheet
- Excel - Copy Worksheet
- Excel - Hiding Worksheet
- Excel - Delete Worksheet
- Excel - Close Workbook
- Excel - Open Workbook
- Excel - Context Help
- Editing Worksheet
- Excel - Insert Data
- Excel - Select Data
- Excel - Delete Data
- Excel - Move Data
- Excel - Rows & Columns
- Excel - Copy & Paste
- Excel - Find & Replace
- Excel - Spell Check
- Excel - Zoom In-Out
- Excel - Special Symbols
- Excel - Insert Comments
- Excel - Add Text Box
- Excel - Undo Changes
- Formatting Cells
- Excel - Setting Cell Type
- Excel - Setting Fonts
- Excel - Text Decoration
- Excel - Rotate Cells
- Excel - Setting Colors
- Excel - Text Alignments
- Excel - Merge & Wrap
- Excel - Borders and Shades
- Excel - Apply Formatting
- Formatting Worksheets
- Excel - Sheet Options
- Excel - Adjust Margins
- Excel - Page Orientation
- Excel - Header and Footer
- Excel - Insert Page Breaks
- Excel - Set Background
- Excel - Freeze Panes
- Excel - Conditional Format
- Working with Formula
- Excel - Creating Formulas
- Excel - Copying Formulas
- Excel - Formula Reference
- Excel - Using Functions
- Excel - Builtin Functions
- Advanced Operations
- Excel - Data Filtering
- Excel - Data Sorting
- Excel - Using Ranges
- Excel - Data Validation
- Excel - Using Styles
- Excel - Using Themes
- Excel - Using Templates
- Excel - Using Macros
- Excel - Adding Graphics
- Excel - Cross Referencing
- Excel - Printing Worksheets
- Excel - Email Workbooks
- Excel- Translate Worksheet
- Excel - Workbook Security
- Excel - Data Tables
- Excel - Pivot Tables
- Excel - Simple Charts
- Excel - Pivot Charts
- Excel - Keyboard Shortcuts
- MS Excel Resources
- Excel - Quick Guide
- Excel - Useful Resources
- Excel - Discussion
How to Apply Different Headers or Footers on Each Page on an Excel Spreadsheet?
Mostly, we use header and footer in MS Word, but have you ever tried using the header and footer for work sheets in Excel? This process will divide the infinite Excel sheets into pages and add headers and footers. However, when we apply a header and footer to the first sheet, the same header and footer are added to all the pages in the worksheet, but sometimes you want to add different headers and footers on each process. This tutorial will help you solve this problem, i.e., help you understand how we can apply different headers and footers on each page on an Excel sheet.
Applying Different Headers or Footers on Each Page in Excel
Here we will first create a VBA module and then attach it to a shape. Let us see a simple process to understand how we can apply different headers or footers on each page on an Excel spreadsheet.
Step 1
Let us consider a new Excel sheet. Now right-click on the sheet name and select view code to open the vba application, then click on insert, select module, and enter the programme as shown in the below image.
Program
Sub DifferentHeaderFooter() 'Updated By Nirmal Dim ws As Worksheet Dim vLeft As Variant, vRight As Variant, xRg As Variant Set ws = ActiveSheet On Error Resume Next vLeft = Array("First page", "Second page", "Third page", "fourth page") xRg = Array("A1:C50", "A51:C100", "A101:C150", "A151:C200") Application.ScreenUpdating = False For i = 0 To UBound(vLeft) With ws.PageSetup .PrintArea = xRg(i) .LeftHeader = vLeft(i) End With ws.PrintPreview Next i Application.ScreenUpdating = True ws.PageSetup.PrintArea = "" End Sub
Step 2
Now, save the sheet with macros enabled and exit the application by pressing Alt + Q. Draw a rectangle shape, right-click on it, and select "Assign a macro." A pop-up window will appear, as shown in the below image.
Then click on the button, and a different header will be applied to the sheets in the print preview mode. Now, to add different footers, replace the work header with a footer in the VBA code.
Conclusion
In this tutorial, we used a simple example to demonstrate how we can apply different headers and footers on each page of an Excel spreadsheet to highlight particular sets of data.
- Related Articles
- How to add background color to headers or footers in an Excel sheet while printing
- How to disable browser print options (headers, footers, margins) from the page with CSS?
- How to Apply Conditional Formatting based on VLOOKUP in Excel?
- How to apply t test on each row of an R data frame?
- How to open an Excel Spreadsheet in Treeview widget in Tkinter?
- How to apply XSL transformation on an XML document?
- How to Apply Conditional Formatting to a Column Based on Another Column in Excel?
- How to add header or footer to first page only in an Excel worksheet?
- How to Apply Colour Banded Rows or Columns in Excel?
- How to apply different titles for each different subplots using Plotly in Python?
- How to apply Affine Transformation on an image in OpenCV Python?
- How to apply Perspective Transformations on an image using OpenCV Python?
- How to Apply Makeup on Hooded Eyes?
- How to Apply Makeup on Textured Skin?
- How to Apply Makeup on Oily Skin?
