Hello chaps, I'm getting stuck amending some code that was kindly supplied to me yesterday from here.
I am attempting to count cells based on a criteria. Countif was used for this originally but now as the criteria has become case sensitive I'm looking to use the Find function.
All I want to do is find all instances of a string (case sensitive), in the workbook and return the count of such instances. I'm getting muddled up with how to initialise and add to the counter. Really grateful for any help :=)
here is the code I have so far..
I am attempting to count cells based on a criteria. Countif was used for this originally but now as the criteria has become case sensitive I'm looking to use the Find function.
All I want to do is find all instances of a string (case sensitive), in the workbook and return the count of such instances. I'm getting muddled up with how to initialise and add to the counter. Really grateful for any help :=)
here is the code I have so far..
Code:
Function FindString(A02)
For Each sht In ActiveWorkbook.Sheets
If Not sht.Name = "LIST" Then
foundcells = Cells.Find(What:=A02, After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=True, SearchFormat:=False)
For Each Foundcell In foundcells
xcount = xcount + 1
Next
End If
Next
FindString = xcount
End Function