Count only positive numbers
Macro Title:
|
Worksheet Variable:
|
Worksheet Name:
|
Range Reference:
range from which you want to count the number of cells that contain only positive numbers |
Output Cell:
|
First Comment:
' |
Second Comment:
' |
Sub Count_only_positive_numbers()
'declare a variable
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'count only positive numbers
ws.Range("D5") = Application.WorksheetFunction.CountIf(ws.Range("B5:B11"), ">0")
End Sub
Sub Count_only_positive_numbers()
'declare a variable
Dim ws As Worksheet
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'count only positive numbers
ws.Range("D5") = Application.WorksheetFunction.CountIf(ws.Range("B5:B11"), ">0")
ws.Range("D5") = Application.WorksheetFunction.CountIf(ws.Range("B5:B11"), ">0")
End Sub