Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel VBA中的自定义countif函数,带条件,不带工作表应用程序_Excel_Vba - Fatal编程技术网

Excel VBA中的自定义countif函数,带条件,不带工作表应用程序

Excel VBA中的自定义countif函数,带条件,不带工作表应用程序,excel,vba,Excel,Vba,我必须在VBA中自定义一个只计算正数的countif函数,它看起来可能很简单,但如果不使用worker.application,则要困难得多。有人能帮我吗?函数必须看起来像 Function Nombrespositifs( x as range) End function Mod在这里工作得很好 谢谢,但是我在一列中有190个数字,有些是正数,有些是负数,我必须选择列中的所有数字,我的函数必须告诉我它包含多少正数 Option Explicit Function COUNTEVEN(T

我必须在VBA中自定义一个只计算正数的countif函数,它看起来可能很简单,但如果不使用worker.application,则要困难得多。有人能帮我吗?函数必须看起来像

Function Nombrespositifs( x as range)

End function

Mod
在这里工作得很好



谢谢,但是我在一列中有190个数字,有些是正数,有些是负数,我必须选择列中的所有数字,我的函数必须告诉我它包含多少正数
Option Explicit

Function COUNTEVEN(Target As Range)

Dim myCell As Range

For Each myCell In Target
    If IsNumeric(myCell) And 1 - (myCell Mod 2) Then
        COUNTEVEN = COUNTEVEN + myCell
    End If
Next myCell

End Function