How can i write a comments in excel footer

Asked By 20 points N/A Posted on -
qa-featured

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. 

Ok, thanks,

Have a good time.

SHARE
Best Answer by Sharath Reddy
Best Answer
Best Answer
Answered By 590495 points N/A #177577

How can i write a comments in excel footer

qa-featured

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.

Sub InsertHeaderFooter()
' 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
        With ws.PageSetup
            .LeftHeader = "Company name"
            .CenterHeader = "Page &P of &N"
            .RightHeader = "Printed &D &T"
            .LeftFooter = "Path : " & ActiveWorkbook.Path
            .CenterFooter = "Workbook name &F"
            .RightFooter = "Sheet name &A"
        End With
    Next ws
    Set ws = Nothing
    Application.StatusBar = False
End Sub

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
End Sub

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.

Related Questions