Bonjour,

J'ai un petit souci au début de ma boucle, j'ai N1 = "0" & N, N étant mon premier numéro. Quand je boucle I fois.

Quand je passe la première fois dans ma boucle à la sortie j'ai bien 01 pour le premier, mais au second tous j'obtiens 2.

Voici un bout de mon code, j'ai plusieurs dossier et fichier qui sont modifiés pat cette boucle.

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
Private Sub TextBox15_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Dim I As String
Dim N As Variant
Dim N1 As Integer
Dim MonDossier4 As String
Dim MonDossier5 As String
Dim l As Integer
 
MonDossier4 = "c:\tata"  ' exemple de dossier
 
    If KeyCode = 13 Then
     N = TextBox12.Value
     I = TextBox9.Value
 
If TextBox15 = 1 Then
N1 = N
End If
If TextBox15 = 2 Then
N1 = "0" & N
End If
 
 
        While N1 <= I
 
                l = 0
 
             MonDossier5 = MonDossier4 & "\" & "titi" & N1 & "_" & TextBox2
             If DossierExiste(MonDossier5) = True Then
                MsgBox "Le dossier existe..."
             Else
              MkDir (MonDossier5)
             End If
 
                N1 = N1 + 1
 
        Wend
 
    End If
End Sub
Merci de votre aide.