I recorded a macro to update the headers and footers of an Excel document. I later found that I hadn't included the tab name and page number in the bottom right as I had intended.
I'm not really VB savvy, but I did find the code and follow the pattern in previous lines to try to get the tab and page, resulting in the following.
Sub CellInFooter()
With ActiveSheet
.PageSetup.LeftHeader = "Company Name"
.PageSetup.RightHeader = Sheets("Document Info").Range("B6").Value
.PageSetup.LeftFooter = Sheets("Document Info").Range("B2").Value
.PageSetup.CenterFooter = Sheets("Document Info").Range("B5").Value
.PageSetup.RightFooter = "&[Tab], &[Page]"
End With
End Sub
Apparently, the ampersand is an escape character, so the result was "Tab], Page]" showing up in the right footer.
So, what's the correct code to achieve the desired effect?
Bookmarks