Sub MM1()
Dim r As Integer
r = Application.WorksheetFunction.CountIf(Range("B2:B15"), Range("A1"))
MsgBox r
End Sub
Are you searching for partial text in the cell, or just the value in the cell ??
Also, what does this have to do with Autofilter ??
If it's whole text use
Code:Sub MM1() Dim r As Integer r = Application.WorksheetFunction.CountIf(Range("B2:B15"), Range("A1")) MsgBox r End Sub The cells will contain more than A1 So the autofilter has the function contains however it sorts the rows but not give me a result of number of rows
Can you post a small sample of your data AND A1
Option Compare Text
Sub MM1()
Dim lr As Long, r As Long, n As Integer
lr = Cells(Rows.Count, "E").End(xlUp).Row
n = 0
For r = lr To 1 Step -1
If InStr(Range("E" & r).Value, Range("A1").Value) Then
n = n + 1
End If
Next r
MsgBox "There are " & n & " occurences in the list"
End Sub