Total for each page when printing

craigg3

Board Regular
Joined
Dec 23, 2002
Messages
161
Office Version
  1. 2013
Platform
  1. Windows
I have a worksheet with about 200 rows of data and about 10 columns, but the number of rows can change periodically.
Is there a way to add a button and stick some coding behind it where it will print the worksheet and for each page that is printed it will total the column "G" for each page? Thanks.
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Use macro to set footer and print setup / area

Craig,

Here's a basic macro that you can place in the workbook that will modify the footer based on a cell value just before printing. Just add a cell with a formula that sums column G and then have the macro below point to that cell.

You can add the sub "SetPrintArea" below to auto set the print area and then use the sub below called "PrintSheet" to print the active sheet to the default printer. If you want you could have a button that points to either a macro that calls the SetPrintArea sub & the PrintSheet sub or just point the button to the PrintSheet sub...

Hope it helps...

Code:
Option Explicit

Private Sub Workbook_BeforePrint(Cancel As Boolean)

SetFooter

End Sub


Sub SetFooter()

    With Worksheets("master schedule")
      .PageSetup.CenterFooter = "Data Imported On:" & vbCr & Sheets("WipMstr_Data").Range("A2").Value
    End With
     
End Sub



Sub SetPrintArea()

ActiveSheet.PageSetup.PrintArea = Range("Y3", Range("C65536").End(xlUp)).Address

End Sub



Sub PrintSheet()

    ActiveWindow.SelectedSheets.PrintOut

End Sub
 
Upvote 0
Thanks for the reply. You said to add a cell with the total for column "G" and have the macro point to that cell. Where in the code you supplied would I point it to that cell?

Thanks.
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,331
Members
449,077
Latest member
jmsotelo

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