Bonjour à tous, 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
Private Sub CommandButton1_Click()
    
    Dim R As Range
    Dim cel As Range
    Dim mat As String
    Dim nom As String
    Dim typ As String
    Dim grp As String
    
    Set R = Worksheets("Utilisateurs_Autorisés").Range("A2:A100")
    
    For Each cel In R
        If cel.Value = UCase(UserForm2.Matricule.Value) Then
            Set mat = cel.Value
            Set nom = cel.Offset(0, 1).Value
            Set typ = cel.ooset(0, 2).Value
            Set grp = cel.Offset(0, 3).Value
            MsgBox "OK"
            UserForm2.Height = 300
            
            If typ = "IC" Then
                With UserForm2
                    .IAP.Enabled = False
                    .D.Enabled = False
                    .Région.Enabled = False
                End With
            End If
                
                
            Exit Sub
        Else
            MsgBox "non"
            Exit Sub
        End If
    Next cel
            
End Sub
La ligne contenant l'erreur est en gras. L'erreur renvoyée est dans le titre, je ne vois pas ce que je fais de mal, je veux juste assigner à ma variable mat (string) une valeur (cel.value) cel étant la liste de mes matricules autorisés.
Si quelqu'un a une idée...
D'avance je vous remercie.