Bonjour,

Je ne sais pas si quelqu'un a déjà rencontré ce problème, mais ActiveSheet ne renvoie pas un objet sheet. Si j'utilise un ActiveSheet.name il me renvoie le nom sur le debug.print.
j'utilise mon code pour réinitialiser un userform, dans une autre macro je n'ai pas ce problème pourtant le principe est le même.
quelqu'un aurait une idée? le code n'a rien d'extraordinaire
merci de votre collaboration

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
Sub AlimenterTxtBox()
Dim f2 As Worksheet
Dim l As Integer
 
Set f2 = ThisWorkbook.Sheets("SUP_Tools")
 
l = f2.Range("A" & Rows.Count).End(xlUp).Row
NumCountTool = 0
Debug.Print ActiveSheet.Name
 
Do While NumCountTool < l + 1 And ActiveSheet.Range("B11").Value = f2.Cells(NumCountTool, 1).Value
NumCountTool = NumCountTool + 1
Loop
Debug.Print NumCountTool
 
If f2.Cells(NumCountTool, 6) <> "" Then
                                     Me.OPT_Cloture.Value = False
                                    Else
                                    Me.OPT_Cloture.Value = True
End If
 
If f2.Cells(NumCountTool, 5) <> "" Then
                                     Me.OPT_Rapport.Value = False
                                    Else
                                    Me.OPT_Rapport.Value = True
End If
 
Me.TXT_DateClotue.Value = f2.Cells(NumCountTool, 7).Value
Me.TXT_COM = f2.Cells(NumCountTool, 8).Value