If Sheets("Feuil1").Range("AN" & j).Value = Sheets("Feuil1").Range("B" & i).Value And Sheets("Feuil1").Range("G" & j).Value < Sheets("Feuil1").Range("C" & i).Value Then
Application.ScreeUpdationg = False
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionPrivate Sub CommandButton6_Click() Application.ScreenUpdating = False For j = 1 To 8761 For i = 10 To 38 If Sheets("Feuil1").Range("AN" & j).Value = Sheets("Feuil1").Range("B" & i).Value And Sheets("Feuil1").Range("G" & j).Value < Sheets("Feuil1").Range("C" & i).Value Then Sheets("Feuil1").Range("AO" & i).Value = 0 Exit For End If Next i Next j Application.ScreenUpdating = True End Sub
with Sheets("Feuil1") For j = 1 To 8761 For i = 10 To 38 If .Range("AN" & j).Value = .Range("B" & i).Value And .Range("G" & j).Value < .Range("C" & i).Value Then .Range("AO" & i).Value = 0 Exit For End If Next i end with
Private Sub CommandButton6_Click() dim cond1 as string, cond2 as string ' <<<< ==== j'ai mis string car j'ignore le format. Corrige en fonction Application.ScreenUpdating = False For j = 1 To 8761 cond1 = Sheets("Feuil1").Range("AN" & j).Value cond2 = Sheets("Feuil1").Range("G" & j).Value For i = 10 To 38 If cond1 = Sheets("Feuil1").Range("B" & i).Value And cond2 < Sheets("Feuil1").Range("C" & i).Value Then Sheets("Feuil1").Range("AO" & i).Value = 0 Exit For End If Next i Next j Application.ScreenUpdating = True End Sub
Private Sub CommandButton6_Click() dim j as long dim cond1 as string, cond2 as string ' <<<< ==== j'ai mis string car j'ignore le format. Corrige en fonction j = 1 while j <= 8761 cond1 = Sheets("Feuil1").Range("AN" & j).Value cond2 = Sheets("Feuil1").Range("G" & j).Value For i = 10 To 38 If cond1 Sheets("Feuil1").Range("B" & i).Value And cond2 < Sheets("Feuil1").Range("C" & i).Value Then Sheets("Feuil1").Range("AO" & i).Value 0 doevents Next i j = j +1 doevents wend End Sub
je ne vois pas pourquoi tu fait "exit for" alors qu'il n'a pas préciser qu'il va y avoir un seule changement
Application.Calculation = xlCalculationManual
Application.Calculation = xlCalculationAutomatic