Please need your urgent assistance!
Kindly find below the code that I have written in VBA to return the occurrences of a certain search variable within a column array or row array..
===========================================================================
Public Function CheckOccurrences(MyRange As Range, SearchValue As Variant) As Integer()
Dim iii As Integer, Counter As Integer, ResultList As Range
Counter = 1
For iii = 1 To WorksheetFunction.CountA(MyRange)
If MyRange.Cells(iii, 1) = SearchValue Then
ResultList(Counter) = iii
Counter = Counter + 1
End If
Next iii
CheckOccurrences = ResultList
End Function
===================================================================
When applying into Excel cell, it is returning an error #Value!
Could you please advise?!
Thank you!
Bookmarks