How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask Richard Your Own Question

Richard
Richard, Software Specialist
Category: Microsoft Office
Satisfied Customers: 32073
Experience:  Over 15 year experience resolving Microsoft Office Issues
32989067
Type Your Microsoft Office Question Here...
Richard is online now
A new question is answered every 9 seconds

I have Excel 2007. Is it possible to add different footers

This answer was rated:

I have Excel 2007. Is it possible to add different footers on the same spreadsheet that have page breaks on it?
(Ex 10 on the first page and then 11 on the second and 12 on the third)?

Regards
Thank you for your question, my name is Richard.

You can, but it needs to be done via Code.

I have put the required code below for you

step 1

1) press ALT+F11 to open VB editor.
2) Insert > module and paste the code below on the right


Sub myMacro()
Dim ws As Worksheet
Dim vLeft As Variant, vRight As Variant, vRng As Variant
Set ws = ActiveSheet
vLeft = Array("left1", "left2", "left3", "left4", "left5", "left6", "left7")
vRight = Array("right1", "right2", "right3", "right4", "right5", "right6", "right7")
vRng = Array("A1:C10", "K15:O30", "D1:G30", "A50:C60", "D7:G10", "AA1:AC40", "BB1:BD30")
Application.DisplayAlerts = False
For i = 0 To UBound(vLeft)
With ws.PageSetup
.PrintArea = vRng(i)
.LeftFooter = vLeft(i)
.CenterFooter = "&D" 'date
.RightFooter = vRight(i)
End With
ws.PrintPreview
Next i
ws.PageSetup.PrintArea = ""
Application.DisplayAlerts = True
End Sub

3) in the code, change:
(left1 is left Footer, righ1 is right Footer,....)
left1, left2,...right1, right2,....
and the range:
A1:C10, K15:O30,.... .... as yours

4) Close VB editor.

step2

To run the macro, press ALT+F8,

select MyMacro from the list and click the run button.


note
if you don't want
Print Preview
change:
ws.PrintPreview
to:
ws.PrintOut

This is the only way to achieve this.

If you have continued problems, or would like any additional information or assistance, please do not hesitate to let me know.

And if you can take a second to rate my service, that would be greatly appreciated.

Thank you
Customer: replied 3 years ago.

Thank you it's working


One question: I want the footer (number) to be in the centre and nothing else on the bottom left or right. What do I change on the code?


 

Nothing, you set this in the footers themselves, set text alignment to center. type some text in it to test.

If you have continued problems, or would like any additional information or assistance, please do not hesitate to let me know.

And if you can take a second to rate my service, that would be greatly appreciated.

Thank you
Richard and 2 other Microsoft Office Specialists are ready to help you