ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Can you create a dynamic footer in Excel? (https://www.excelbanter.com/excel-discussion-misc-queries/229279-can-you-create-dynamic-footer-excel.html)

mge

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

mge

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



All times are GMT +1. The time now is 06:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com