Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Page Breaks and Subtotals

Hopefully this makes sense and someone can assist with this relative
newbie's pagebreak/subtotals question.

I've got a worksheet with data as follows:

Type A Type B Total By Location
Location A 0 1 1
Location B 1 4 5
Total By Type 1 5

The report is variable length (both rows and columns) and I want to be
able to create a macro to search for each pagebreak (HPageBreak and
VPageBreak) and insert a subtotal just before (so the subtotal is the
last row and column of each page). Then, on the last page of the
report, have a final Subtotal and Grand Total row and column.

I've searched for ideas and it seems that Data | Subtotals might work,
but I am fairly new to Excel and can't seem to get it to work without
getting a subtotal in every other row, which I don't want.

Can anyone offer a suggestion on a way to do this?

TIA,
Yellowbird
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Page Breaks and Subtotals

There is no built in function to do this.

You would have to search through the HPageBreak collection from top to
bottom (since as you insert coming down, the breaks will change), insert a
row above the pagebreak and put in the formula to sum. then do the
VPageBreak from left to right.

--
Regards,
Tom Ogilvy

"Yellowbird" wrote in message
om...
Hopefully this makes sense and someone can assist with this relative
newbie's pagebreak/subtotals question.

I've got a worksheet with data as follows:

Type A Type B Total By Location
Location A 0 1 1
Location B 1 4 5
Total By Type 1 5

The report is variable length (both rows and columns) and I want to be
able to create a macro to search for each pagebreak (HPageBreak and
VPageBreak) and insert a subtotal just before (so the subtotal is the
last row and column of each page). Then, on the last page of the
report, have a final Subtotal and Grand Total row and column.

I've searched for ideas and it seems that Data | Subtotals might work,
but I am fairly new to Excel and can't seem to get it to work without
getting a subtotal in every other row, which I don't want.

Can anyone offer a suggestion on a way to do this?

TIA,
Yellowbird



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,979
Default Page Breaks and Subtotals

One way to use subtotals:

Insert a new column in the table, with the heading "Page"
In the cell below, enter a formula to calculate the page number, e.g.:
=INT(COUNTA($A$1:A2)/56)+1
where 56 is the number of rows per page
Copy the formula down to the last row of data
Select a cell in the table, and choose DataSubtotals
Choose to group at each change in "Page"
Select the fields you want to total
Add a check mark to 'Page break between groups'
Click OK

You can hide the Page column, or exclude it from the print area.

Yellowbird wrote:
Hopefully this makes sense and someone can assist with this relative
newbie's pagebreak/subtotals question.

I've got a worksheet with data as follows:

Type A Type B Total By Location
Location A 0 1 1
Location B 1 4 5
Total By Type 1 5

The report is variable length (both rows and columns) and I want to be
able to create a macro to search for each pagebreak (HPageBreak and
VPageBreak) and insert a subtotal just before (so the subtotal is the
last row and column of each page). Then, on the last page of the
report, have a final Subtotal and Grand Total row and column.

I've searched for ideas and it seems that Data | Subtotals might work,
but I am fairly new to Excel and can't seem to get it to work without
getting a subtotal in every other row, which I don't want.

Can anyone offer a suggestion on a way to do this?

TIA,
Yellowbird



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I can't move my page breaks in Page Break Preview btaft Excel Discussion (Misc queries) 6 April 27th 23 11:49 AM
When automatic page breaks are moved each cell becomes a new page Queso hotmail com> Excel Discussion (Misc queries) 0 March 30th 10 03:08 AM
Vertical page breaks won't drag in Page Break Preview Caroline Excel Discussion (Misc queries) 0 July 14th 09 12:19 PM
How do I do page breaks when view menu doesnt page break preview HeatherF55 Excel Discussion (Misc queries) 0 September 21st 07 04:24 AM
Page breaks when using subtotals Pele Excel Worksheet Functions 2 May 19th 05 08:34 PM


All times are GMT +1. The time now is 08:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"