A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Can you create a dynamic footer in Excel?



 
 
Thread Tools Display Modes
  #1  
Old April 29th, 2009, 09:01 PM posted to microsoft.public.excel.misc
mge
external usenet poster
 
Posts: 8
Default Can you create a dynamic footer in Excel?

I would like to include a footer that reads from the sheet being printed.
Does anyone know of a practical way to do this?
--
mgelde
  #2  
Old April 29th, 2009, 10:16 PM posted to microsoft.public.excel.misc
mge
external usenet poster
 
Posts: 8
Default Can you create a dynamic footer in Excel?

I was able to come up with code that does this. See Below:

This code goes in the VBAProject Workbook section

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim Wks As Worksheet
Dim stFullFileName As String
Dim stCompanyName As String

stCompanyName = Worksheets("Sheet1").Range("G19").Value
stFullFileName = ThisWorkbook.FullName
For Each Wks In ThisWorkbook.Worksheets
With Wks.PageSetup
.LeftFooter = stCompanyName
.CenterFooter = ""
.RightFooter = ""
End With
Next Wks

End Sub




--
mgelde


"mge" wrote:

I would like to include a footer that reads from the sheet being printed.
Does anyone know of a practical way to do this?
--
mgelde

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:27 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.