N/APosted on - 07/23/2013
Hello Excel Expert,
I want to write a comment in excel footer without using header & footer option.
I want to write the comments using code.
My question " HOW CAN I WRITE THE CODE & WHERE I WRITE THE CODE" for Example I want to write "Powered by Tareq" when I print the excel sheet then print the
Powered by Tareq" in the footer.
It is printable but not visible.
Have a good time.
How can i write a comments in excel footer
Here is an example of a VBA code that will insert both the header and footer on your worksheet.
It also displays the full path of the document in the footer.
' inserts the same header/footer in all worksheets
Dim ws As Worksheet
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
Application.StatusBar = "Changing header/footer in " & ws.Name
.LeftHeader = "Company name"
.CenterHeader = "Page &P of &N"
.RightHeader = "Printed &D &T"
.LeftFooter = "Path : " & ActiveWorkbook.Path
.CenterFooter = "Workbook name &F"
.RightFooter = "Sheet name &A"
Set ws = Nothing
Application.StatusBar = False
Since you only need the footer, simply modify this code for your requirement. The only limitation of this code is that it doesn’t hide the footer in the worksheet. To possibly hide it, try using this code:
Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As Integer)
Me.PageFooterSection.Visible = False
I have modified this from its original code since you want to hide all footers in your file.
Since you are asking for VBA codes to hide information on your document, I am assuming that you have knowledge on editing VBA codes.