Count cells that contain even numbers
Macro Title:
|
Worksheet Variable:
|
Worksheet Name:
|
Range:
enter the range from which you want to count the number of cells that contain even numbers |
Output Cell:
|
First Comment:
' |
Second Comment:
' |
Sub Count_cells_that_contain_even_numbers()
'declare a variable
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'count cells that contain even numbers
ws.Range("D5").Formula = "=SUMPRODUCT(--(MOD(B5:B9,2)=0))"
End Sub
Sub Count_cells_that_contain_even_numbers()
'declare a variable
Dim ws As Worksheet
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'count cells that contain even numbers
ws.Range("D5").Formula = "=SUMPRODUCT(--(MOD(B5:B9,2)=0))"
ws.Range("D5").Formula = "=SUMPRODUCT(--(MOD(B5:B9,2)=0))"
End Sub