|
- Function SMultipleSheets(criteriaRange As Range, criteriaValue As Variant, startDate As Date, endDate As Date) As Double
- Dim totalSum As Double
- Dim ws As Worksheet
- Dim criteriaColumn As Range
- Dim sums As Range
- Dim dateRange As Range
- totalSum = 0
- For Each ws In ThisWorkbook.Worksheets
- If ws.Name <> "Summary" And ws.Name <> "OtherExclusionSheetName" Then
- Set sums = ws.Range("G:G")
- Set criteriaColumn = ws.Range("A:A")
- Set dateRange = ws.Range("H:H")
- totalSum = totalSum + Application.WorksheetFunction.SumIfs(sums, criteriaColumn, criteriaValue, dateRange, ">=" & startDate, dateRange, "<=" & endDate)
- End If
- Next ws
- SMultipleSheets = totalSum
- End Function
复制代码 |
评分
-
1
查看全部评分
-
|