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