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" then associate this number with a variable,
"19/12/11" or "Green"
Does anyone have any ideas?
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.
1.4m articles
1.4m replys
5 comments
57.0k users