Hi,
I have the following code. When I run it I got the following error message at this line: Set c1 = Rng.Find("item_1", LookIn:=xlValues).
Run-time error
Automation error
The Object invoked has disconnected from its clients
Wonder if someone could point to me how I could fix the error or point out what's wrong. Thank you!
I have the following code. When I run it I got the following error message at this line: Set c1 = Rng.Find("item_1", LookIn:=xlValues).
Run-time error
Automation error
The Object invoked has disconnected from its clients
Wonder if someone could point to me how I could fix the error or point out what's wrong. Thank you!
Code:
Sub status_And_check()
Dim get_Row As Object
Set get_Row = CreateObject("Scripting.Dictionary")
Set get_Row = Q_check()
Debug.Print get_Row.Item("item_1")
End Sub
Function Q_check()
Dim check_Dict As Object
Set check_Dict = CreateObject("Scripting.Dictionary")
Set Rng = ThisWorkbook.Worksheets("sheet1").Range("B:B")
Set c1 = Rng.Find("item_1", LookIn:=xlValues)
If Not c1 Is Nothing Then
check_Dict.Add "item1", c1.Row
End If
Set c2 = Rng.Find("item_2", LookIn:=xlValues)
If Not c2l Is Nothing Then
check_Dict.Add "item_2", c2.Row
End If
Set Q_check() = check_Dict
End Function