I have an excel file with an unknown end range (which changes every time) and I want to know the amount of rows that the specific word comes back in that data table.
It is just one column, and I have tried so many different methods but I still do not know the solution to it.
This is the VBA code:
Sub count_cookies()
lastrow = Worksheets("table").Cells(Rows.Count, 1).End(xlUp).Row
Worksheets("table").Cells(6, 2) = WorksheetFunction.CountIf(Range("data!A2:A" & lastrow), "* cookies *")
End Sub
So I want the amount counted from sheet "data" to sheet "table", but what am I doing wrong?
EDIT: I got a question, I have filtered data, but countif still counts all of the data, how can I count only the filtered data? IS there a different formula for this?