Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/23.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-在VBA公式R1C1中使用用户输入日期(或使用变量)_Excel_Vba_Formula - Fatal编程技术网

Excel VBA-在VBA公式R1C1中使用用户输入日期(或使用变量)

Excel VBA-在VBA公式R1C1中使用用户输入日期(或使用变量),excel,vba,formula,Excel,Vba,Formula,我必须在vba中的某些单元格上使用并扩展此公式,但在vba中尝试不使用某些硬编码日期时,我遇到了一些问题 ActiveCell.FormulaR1C1 = _ "=COUNTIFS(JdT!R5C19:R490C19,"">=02/05/2016"",JdT!R5C19:R490C19,""<=24/05/2016"",JdT!R5C7:R490C7,RC7,JdT!R5C8:R490C8,R1C)+COUNTIFS(JdT!R5C19:R490C19,"">=

我必须在vba中的某些单元格上使用并扩展此公式,但在vba中尝试不使用某些硬编码日期时,我遇到了一些问题

ActiveCell.FormulaR1C1 = _
        "=COUNTIFS(JdT!R5C19:R490C19,"">=02/05/2016"",JdT!R5C19:R490C19,""<=24/05/2016"",JdT!R5C7:R490C7,RC7,JdT!R5C8:R490C8,R1C)+COUNTIFS(JdT!R5C19:R490C19,"">=02/05/2016"",JdT!R5C19:R490C19,""<=24/05/2016"",JdT!R5C7:R490C7,RC7,JdT!R5C10:R490C10,R1C)+COUNTIFS(JdT!R5C19:R490C19,"">=02/05/2016"",JdT!R5C19:R490C19,""<=24/05/2016"",JdT!R5C7:R490C7,RC7,JdT!R5C12:R490C12,R1C)"
我想用它来代替公式中的硬编码日期。我该怎么做呢?

“>=”&start\u date&“
这样写好像行得通。非常感谢Charlie
“>=”&start\u date&“
这样写好像行得通:“>=”&start\u date2&“。非常感谢你,查理
start_date = DateSerial(start_year, start_month, start_day) // user input

end_date = DateSerial(end_year, end_month, end_day) // user input