VBA Count cells in column containing specified value

后端 未结 5 1352
既然无缘
既然无缘 2020-12-08 07:11

I need to write a macro that searches a specified column and counts all the cells that contain a specified string, such as \"19/12/11\" or \"Green\"

5条回答
  •  臣服心动
    2020-12-08 07:49

    Do you mean you want to use a formula in VBA? Something like:

    Dim iVal As Integer
    iVal = Application.WorksheetFunction.COUNTIF(Range("A1:A10"),"Green")
    

    should work.

提交回复
热议问题