View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default 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!