Inserting page sum in footer

JML0328

Board Regular
Joined
Jul 24, 2010
Messages
62
Hello:

I'm trying to get my Excel spreadsheet to insert the sum of a certain column in the footer of each page it prints.

I checked the header/footer orientation and could not find anything.

Any ideas?
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
You would need to use some VBA to get a cell contents into Headers/Footers.

<font face=Courier New><SPAN style="color:#00007F">Sub</SPAN> headfoot()<br><SPAN style="color:#00007F">With</SPAN> ActiveSheet<br>    .PageSetup.LeftFooter = Range("D4")<br><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">With</SPAN><br><SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>
 
Upvote 0
I tried that and put in the formula I wanted and it gave me an error. Sub or function not defined.
 
Upvote 0
Where did you add the code and run the macro?

You need to use Alt + F11 on the keyboard then go to Insert and Select Module copy the code across and close the VBA screen.

Then in the workbook use Alt + F8 on the sheet you want the macro to work on and then select the macro and it should work.
 
Upvote 0
The macro works. I placed the range in (E7:E37). But in this case, it only gave me the value of the E7 cell. I need to the sum of all the values in the E column on that page.

I tried to use the SUM function instead and got that error.

Sorry if I'm being vague.
 
Upvote 0
Can you create a formula in another column to sum the range and then hide that column you can then use the cell id to give you the value.
 
Upvote 0
Yes, I will give that try. If not, I have another method lined up.

Thanks so much for your help.
 
Upvote 0

Forum statistics

Threads
1,224,537
Messages
6,179,405
Members
452,911
Latest member
a_barila

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