J'effectue une recherche sur un fichier excel mais je rencontre un soucis erreur execution '13' type incompatible lorque l'execution arrive sur la methode find voici mon code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 
    Dim ObjRange As Object
    Dim ObjPrio As Object
    Dim strLUbReponse As Variant
 
    Set ObjRange = .Worksheets(lbStrQr).Range("B" & CStr(valRowAncien) & ":B" & CStr(valNbChoix) & "")
    'Set ObjRange = .ActiveSheet.Range(Cells(valRowAncien, 2), Cells(valNbChoix, 2)).Cells
   If ObjRange Is Nothing Then
                               MsgBox "ObjRange Non instancié"
                               Set ObjRange = Nothing
                               Set ObjPrio = Nothing
 
                               setReturnReponse = False
                               Exit Function
                            'Else
                            '   ObjRange.Activate
                            End If
 
                           Set ObjPrio = ObjRange.Cells.Find(What:=CStr(strLUbReponse), _
                                                       After:=ActiveCell, _
                                                       LookIn:=xlValues, LookAt:=xlWhole, _
                                                       SearchOrder:=xlByColumns, _
                                                       SearchDirection:=xlNext, _
                                                       MatchCase:=False, SearchFormat:=False)
 
                            If ObjPrio Is Nothing Then
                               MsgBox "ObjPrio Non instancié"
                               Set ObjRange = Nothing
                               Set ObjPrio = Nothing
 
                               setReturnReponse = False
                               Exit Function
 
                            Else
                               ObjPrio.Activate
                            End If
                            'MsgBox
                            'Inserer la valeur réponse user D:D
                            valRowCourant = ActiveCell.Row
 
                            MsgBox valRowCourant