Solved

how to edit the print footer in excel 2010 to refer a range name

Posted on 2013-11-20
2
476 Views
Last Modified: 2013-11-21
In the custom footer, left section, I put the range name there [ModelVersion], but it didn't work.  Any idea?
0
Comment
Question by:jjxia2001
2 Comments
 
LVL 23

Expert Comment

by:NBVC
Comment Utility
You need to do it through a macro.

Here is a Microsoft support article on the subject:

http://support.microsoft.com/kb/273028
0
 
LVL 12

Accepted Solution

by:
Harry Lee earned 200 total points
Comment Utility
jjxia2001,

Excel Header and Footer does not support formula. Which means you cannot simply type in =A10 or =B1 as the header.

One way to do it is to use a vba WorkBook event, BeforePrint. The VBA code has to be under the ThisWorkbook.

To get to the ThisWorkbook VBA code, press Alt-F11 to open up VBA Editor. Then press Ctrl-R to open up the Project Explorer.

On the left, in the Project Explorer, look for the group with the filename of the file you are working on. Under there, you should see some sheets names, and a ThisWorkbook.

Double click to open it, and paste in the following code to test.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim WS As Worksheet
For Each WS In Worksheets
    WS.PageSetup.LeftFooter = ThisWorkbook.FullName & " " & Worksheets("Sheet1").Range("A2").Value
Next WS
End Sub

Open in new window


This code would set the Left Page Foot to the Name of the Sheet + the value in Sheet1 Cell A2.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now