Set xRg = Range("A1").Resize(xDivRow * PageSize1, xDivCol * PageSize2)įor I = 1 To xDivRow * PageSize1 Step PageSize1 + 1įor J = 1 To xDivCol * PageSize2 Step PageSize2Ĭells(I, J).Resize(1, PageSize2) = xTopArrĬells(I, J).Resize(1, PageSize2).Interior.ColorIndex = 34Ĭells(I + PageSize1, J).Resize(1, PageSize2) = xButtArrĬells(I + PageSize1, J).Resize(1, PageSize2).Interior.ColorIndex = 34 If ((xCols Mod PageSize2) > 0) And (xDivCol 0) Then xDivCol = xDivCol + 1 If xRows 0) And (xDivRow 0) Then xDivRow = xDivRow + 1 FooterMargin = Application.InchesToPoints(0)
HeaderMargin = Application.InchesToPoints(0) BottomMargin = Application.InchesToPoints(0) TopMargin = Application.InchesToPoints(0) VBA: Add background color to header and footer Sub FakeHeaderFooter() Click Insert > Module, copy and paste below code to the new module. Press Alt + F11 keys to enable Microsoft Visual Basic for Applications window.Ģ. Here is a VBA code can quickly add background color to header and footer at the same time.ġ. Now the page seems to add background color to header and footer. Repeat step 2 and 3 to add background color to the footer row you want. Go ahead to select a color from Fill color list to add background color to the merged cells.Ĥ.
Then select first row and click Home > Merge & Center.ģ. In the Page Setup dialog, under Margins tab, type 0 into Top, Header, Bottom and Footer textboxes.ģ.
But have you ever tried to add background color to the headers or footers? Actually, there is no built-in function can handle it, but here I introduce some roundabout ways to achieve the operation.Īdd background color to header or footer by Fill colorĪdd background color to header and footer by VBAĢ.
How to change header in word 10 how to#
How to add background color to headers or footers in Excel sheet while printing?Īs we know, we can add contents or picture to the header or footer of a sheet, which will display while printing.