I have created a generic function in VBA which uses the find method to search a range:
Public Function fCheckValueExists(ws As Worksheet, rng As Variant, _
strValue As String) As Variant
fCheckValueExists = ws.Range(rng).Find(strValue, ActiveCell, , , , xlNext, False, , False).Activate
I then want to call this function from controls on user forms. Easy enough so far... However, I always get a type mismatch error when it tries to execute the function. I've tried passing the range as a range datatype as well as a variant, but it doesn't seem to make any difference.
I also tried adding the find code to the sub, but still get a type mismatch error. So, I'm using it incorrectly. What is wrong with the code?