Calculation of footer doesn't take into consideration worksheets more than one page

wpryan

Well-known Member
Joined
May 26, 2009
Messages
533
Office Version
  1. 365
Platform
  1. Windows
Hi All, the workbook I'm working on has some code that automatically sets the footer, namely:
Code:
    Sub Calc_Footer()
    
    Dim ws As Worksheet
    Dim dt As String, SN As String, ft As String
    
    dt = Format(Sheets("General Data").Range("D4"), "dd-mmm-yy")
    SN = Sheets("General Data").Range("B11")
    ft = "FLM SN" & SN & " " & dt
    
    I = 0
    For Each ws In ActiveWorkbook.Worksheets
        If ws.Visible = True Then
            I = I + 1
        End If
    Next
    
    Sheets("Release").PageSetup.RightFooter = ft & "     " & "Page &P of " & I
    Sheets("Summary").PageSetup.RightFooter = ft & "     " & "Page &P of " & I
    Sheets("General Data").PageSetup.RightFooter = ft & "     " & "Page &P of " & I
    Sheets("Slow Scan").PageSetup.RightFooter = ft & "     " & "Page &P of " & I    
    Sheets("Laser Power").PageSetup.RightFooter = ft & "     " & "Page &P of " & I    
    Sheets("Focus Depth").PageSetup.RightFooter = ft & "     " & "Page &P of " & I    
    Sheets("OCT").PageSetup.RightFooter = ft & "     " & "Page &P of " & I    
    Sheets("cCornea").PageSetup.RightFooter = ft & "     " & "Page &P of " & I    
    Sheets("cCat").PageSetup.RightFooter = ft & "     " & "Page &P of " & I    
    Sheets("Misc").PageSetup.RightFooter = ft & "     " & "Page &P of " & I    
    Sheets("PM").PageSetup.RightFooter = ft & "     " & "Page &P of " & I
    
    End Sub
However, there is one worksheet that is longer than one page, therefore the text will show "page 11 of 10". If I set the page height to one page high, then the text is too small. Is there something that can be done to correct this?
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Forum statistics

Threads
1,203,502
Messages
6,055,770
Members
444,822
Latest member
Hombre

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top