Sum Values from multiple sheets based on Summary Sheet Value

wjmay1961

New Member
Joined
Apr 18, 2013
Messages
16
I was hoping someone could help with this code, is it possible to modify the "ArgList" to include sheet names that are represented by a number which is at least 6 characters? I want to include all newly added sheets even though I'm not sure how many might be added.

Option Explicit

Function SUMIF3D( _
CritRng As Range, _
Crit As Variant, _
SumRng As Range, _
ParamArray ArgList() As Variant)

Dim Arg As Variant
Dim wkb As Workbook

Application.Volatile

If IsMissing(ArgList) Then
SUMIF3D = CVErr(xlErrValue)
Exit Function
End If

Set wkb = Application.Caller.Parent.Parent

For Each Arg In ArgList
SUMIF3D = SUMIF3D + _
WorksheetFunction.SumIf(wkb.Sheets(Arg).Range(CritRng.Address), _
Crit, wkb.Sheets(Arg).Range(SumRng.Address))
Next Arg

End Function
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

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