Reputation: 721
I am counting the amount of times a phrase appears in a column. However when I have a large dataset it seems to produce an overflow error.
Here is my code:
Sub Count
Dim count As Integer
Count = Application.WorksheetFunction.CountIf(Range("A:A"), "Bob")
Count = Sheets("Sheet1").Cells(2,8)
End Sub
Is there any way to get around this error when the count is too big?
Upvotes: 2
Views: 329
Reputation: 747
The easy solution is to declare count variable as follows :
Dim count As Long
Upvotes: 2