ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Subtotal Macro Through Numerous Tabs (https://www.excelbanter.com/excel-programming/393135-subtotal-macro-through-numerous-tabs.html)

masterbaker

Subtotal Macro Through Numerous Tabs
 
I'm looking for a macro that will subtotal data on each tab in a worksheet
that has many tabs - and which the number of tabs fluctuates. Basically:

(unsorted source data in sheet1, data sorted by account # on each tab
starting in sheet2)

Subtotal at change in column B; Sum columns A - K for sheet2, then again on
sheet3, and so on until there are no more tabs.

Thanks!

joel

Subtotal Macro Through Numerous Tabs
 
Sub sumworksheets()

Subtotal = 0

For Each ws In Worksheets

If ws.Name < "Sheet1" Then

Subtotal = Subtotal + WorksheetFunction.Sum(Range("A1:B21"))

End If

Next ws


End Sub


"masterbaker" wrote:

I'm looking for a macro that will subtotal data on each tab in a worksheet
that has many tabs - and which the number of tabs fluctuates. Basically:

(unsorted source data in sheet1, data sorted by account # on each tab
starting in sheet2)

Subtotal at change in column B; Sum columns A - K for sheet2, then again on
sheet3, and so on until there are no more tabs.

Thanks!



All times are GMT +1. The time now is 03:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com