Bonjour j'ai un petit problème.
J'ai fais une macro avec une boucle for sans soucis et dès que je rajoute le IF à l'intérieur il me dis "Next sans For"...

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
Sub Generer_avec_dates_clic()
Dim y As Byte, z As Byte, m As Byte, n As Byte
Dim i As Integer, j As Integer
Dim Nom_Reseau As String
Dim Case_Init As Range
Dim Nb_Reseau As String
Dim Date_debut_tx As String
Dim Date_fin_tx As String
Dim Date_ref As String
Dim Case_date_ref As Range
Dim g As Integer
 
'Call SupprSheet
 
'DoEvents
 
With Worksheets("Calcul")
 
    Date_debut_tx = .Range("M8").Value
    Date_fin_tx = .Range("O8").Value
 
    For g = 0 To 62
 
        Set Case_date_ref = .Range("A42").Offset(0, g)
        Date_ref = Case_date_ref.Value
 
        If Date_debut_tx < Date_ref & Date_fin_tx < Date_ref Then
        y = 1
        Else
        y = 0
 
    Next g
 
End With
 
End Sub
Savez vous d'ou cela vient?

Et quand je mets le For et Next en commentaire, il me dit End with sans with...