sum vba excel code example
Example: excel vba sumifs
Sub TestMe()
Dim rValues As Range ' range containing values to sum
Dim rCriteria As Range ' criteria range (must match criteria)
Dim criteria As Variant ' the criteria
Dim ws As Worksheet, i As Integer
'rValues and rCriteria must have the same size
Set rValues = Sheets("Sheet1").Range("B2:B100")
Set rCriteria = Sheets("Sheet1").Range("C2:C100") ' True or False
criteria = "=False"
For i = 2 To 100
ActiveSheet.Cells(i, 4).value = application.WorksheetFunction _
.SumIfs(rValues, rCriteria, criteria)
Next i
End Sub