Can we use : On Error GoTo ...
in a VBA function ?
I always use it to manage my eventual error inside my Sub but when I use it inside a function it's like it didn't work as expected and always go through. When I remove it the function work well.
There is a specific way to manage error in function ?
EDIT
Here is an exemple of one of my function :
Function Row_Nbr_In_Sheet(shtName As String) As Integer
On Error GoTo ErrorManager
Row_Nbr_In_Sheet = ThisWorkbook.Worksheets(shtName).UsedRange.Rows.Count
ErrorManager:
MsgBox("Something weird here")
End
End Function
this function work well without "GoTo" but it trigger the MsgBox when I use it. It's exactly the same for each functions of my code.