Inserting the Sheet Name into the Footer of Every Worksheet in a Workbook

baylorcatholic

New Member
Joined
Sep 4, 2012
Messages
8
As my post title states, I am trying to add the sheet name to the center footer for each worksheet in a workbook. The workbook has about 80 sheets and it is cumbersome to do this manually. I am using Excel 2010.

I have tried to record a macro capturing what I do manually, but when I run the macro on another sheet, it does not add the sheet name to the center footer.

I have tried searching for a macro online and the ones I have found just crash excel.

Any help would be appreciated. I know I am probably missing something obvious in my macro code.
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Post your code if you want help with it. Alternatively, try this:
Code:
Sub Create_Sheet_Footers()

    Dim ws As Worksheet
    
    For Each ws In Worksheets
        ws.PageSetup.CenterFooter = "&A"
    Next
    
End Sub
 
Upvote 0
Thank you.
Your code worked perfectly.
I think my manual macro was capturing too much information and your solution was complete, concise, and correct.
The other macros I found online were 10 times the amount of lines.

Appreciate it.
 
Upvote 0
Thanks. Well done for at least starting with the macro recorder, Excel's free programmer. Many people don't even bother with this simple step.

I just recorded a macro, removed the redundant lines (they all set default values anyway) and then added the loop for each worksheet.
 
Upvote 0

Forum statistics

Threads
1,214,648
Messages
6,120,726
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top