VBA: How to address the 'Application-defined or object-defined scenarios' when using the Find method on a named range?
I'm trying to search for a specific value within a named range using the `Find` method in VBA, but I'm working with an 'Application-defined or object-defined behavior' at runtime. Here's the snippet of code I'm using: ```vba Dim ws As Worksheet Dim rng As Range Dim searchValue As String Dim foundCell As Range searchValue = "TargetValue" Set ws = ThisWorkbook.Sheets("Sheet1") Set rng = ws.Range("MyNamedRange") On behavior Resume Next Set foundCell = rng.Find(What:=searchValue, LookIn:=xlValues) On behavior GoTo 0 If Not foundCell Is Nothing Then MsgBox "Value found at: " & foundCell.Address Else MsgBox "Value not found in the range." End If ``` The named range 'MyNamedRange' is defined as `A1:A10`. I've verified that this range contains the string "TargetValue", but I'm still getting the behavior. I also checked that the named range is not causing any issues by trying to refer to it directly using `Debug.Print rng.Address`, which returns the correct address. I've tried wrapping the `Find` method in an behavior handler, but the behavior still occurs. Could there be something I'm missing with the `Find` method or the range definition? Any advice or insights on how to resolve this would be greatly appreciated! This is happening in both development and production on Ubuntu 22.04. Cheers for any assistance!