Subtotal Challenge??

zakasnak

Active Member
Joined
Sep 21, 2005
Messages
307
I send out purchase orders via excel every day. I have upwards of 30-50 on any given day. I would like a macro that would subtotal each page before being sent out. The header row is the same on every page (row 8) At each change in "PO#" (column A), use function "sum", add subtotal to "Total" (column L).

Also, I would like the page to freeze rows 1-7 at column A (the header on each page is a matter of copying, selecting all the pages & inserting, so is not such a big deal to do. I would insert this before running the macro...)
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
something like this?

Code:
Sub SubTot()
    For Each ws In Worksheets
        ws.Activate
        Set DatRng = Range("A8", Range("A8").End(xlDown).Offset(0, 11))
        DatRng.Subtotal GroupBy:=1, Function:=xlSum, TotalList:=Array(12), _
                Replace:=True, PageBreaks:=False, SummaryBelowData:=True
        ws.PrintOut
        Set DatRng = Range("A8", Range("A8").End(xlDown).Offset(0, 11))
        DatRng.RemoveSubtotal
    Next ws
End Sub
 
Upvote 0
That worked great. I made some changes, but I appreciate your time to get me started on the right foot!!
 
Upvote 0

Forum statistics

Threads
1,215,455
Messages
6,124,936
Members
449,195
Latest member
Stevenciu

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