I have written a function in VBA and I have no idea how to call this.
Public Function FindTwoStrings(rng As Range, s1 As String, _
s2 As String) As Integer
'Application.Volatile
If TypeName(rng) <> "Range" Then Exit Function
Dim cell As Range
Dim accumulator As Integer
For Each cell In rng.Cells
If (InStr(1, UCase(cell.Value), UCase(s1), _
vbTextCompare) > 0) Or (InStr(1, UCase(cell.Value), _
UCase(s2), vbTextCompare) > 0) Then _
accumulator = Me.Cells(cell.Row, 5) + accumulator
Next cell
End Function
How can I call this function in my cell? I have tried to do =Find.... but it cannot find my function. Is there a setting I'm missing?
FindTwoStrings?FindTwoStrings = accumulatorjust beforeEnd Functionand move the entire code to a module.