![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Apr 2002
Posts: 2
|
Hi,
Can anyone tell me if there is a way to make the footers and headers dynamic; that is, can we make the text in the footer or header be dependent on the value of a given cell reference. For example, every time I change the value in cell A1 in some sheet, I would like the footer's text assume the new value in that cell. Thanks in advance Avi |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Feb 2002
Location: Georgia USA
Posts: 544
|
This will put what’s in cell A1 in the left hand header
Sub header() With ActiveSheet.PageSetup .LeftHeader = ActiveSheet.Range("A1") End With End Sub |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Mar 2002
Posts: 175
|
Is it possible to do this without macros?
__________________
Regards, Mike. |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Helena, MT
Posts: 13,690
|
You can also run Paul's code using the before print event
Private Sub Workbook_BeforePrint(Cancel As Boolean) ActiveSheet.PageSetup.RightFooter = Range("A1") End Sub |
|
|
|
|
|
#5 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Quote:
Would suggest doing this via the workbooks sheet change event. Place in the Thisworkbook object The routine will setup (in thiscase) the Footer to A1...change as rrquired. eg Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) If Target.Address = "$A$1" Then With ActiveSheet.PageSetup '## footers here ## '.LeftFooter = "&""Arial Black,Bold""&12" & [A1] .CenterFooter = "&""Arial Black,Bold""&8 " & [A1] '.RightFooter = "&""Times New Roman,Bold""&16" & [A1] End With End If End Sub |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|