zakariamalki
XLDnaute Nouveau
Bonjour,
comment je peux optimiser ce code vba
Do While i <= f
Worksheets(2).Select
If Cells(i, 1) = "Youness JATTI" And Cells(i, 20) <= lundimanquant And Cells(i, 19) = "" Then
Worksheets(1).Select
c = Range("F23").Value
Range("F23").Value = c + 1
Worksheets(2).Select
ElseIf Cells(i, 1) = "Yousra EL ATTAOUI" And Cells(i, 20) <= lundimanquant And Cells(i, 19) = "" Then
Worksheets(1).Select
c = Range("D23").Value
Range("D23").Value = c + 1
ElseIf Cells(i, 1) = "Lamyae EL MAHMOUDI" And Cells(i, 20) <= lundimanquant And Cells(i, 19) = "" Then
Worksheets(1).Select
c = Range("C23").Value
Range("C23").Value = c + 1
ElseIf Cells(i, 1) = "Meryem FNADI" And Cells(i, 20) <= lundimanquant And Cells(i, 19) = "" Then
Worksheets(1).Select
c = Range("E23").Value
Range("E23").Value = c + 1
ElseIf Cells(i, 1) = "Adam NADIM HANBALI" And Cells(i, 20) <= lundimanquant And Cells(i, 19) = "" Then
Worksheets(1).Select
c = Range("G23").Value
Range("G23").Value = c + 1
End If
i = i + 1
Loop
comment je peux optimiser ce code vba
Do While i <= f
Worksheets(2).Select
If Cells(i, 1) = "Youness JATTI" And Cells(i, 20) <= lundimanquant And Cells(i, 19) = "" Then
Worksheets(1).Select
c = Range("F23").Value
Range("F23").Value = c + 1
Worksheets(2).Select
ElseIf Cells(i, 1) = "Yousra EL ATTAOUI" And Cells(i, 20) <= lundimanquant And Cells(i, 19) = "" Then
Worksheets(1).Select
c = Range("D23").Value
Range("D23").Value = c + 1
ElseIf Cells(i, 1) = "Lamyae EL MAHMOUDI" And Cells(i, 20) <= lundimanquant And Cells(i, 19) = "" Then
Worksheets(1).Select
c = Range("C23").Value
Range("C23").Value = c + 1
ElseIf Cells(i, 1) = "Meryem FNADI" And Cells(i, 20) <= lundimanquant And Cells(i, 19) = "" Then
Worksheets(1).Select
c = Range("E23").Value
Range("E23").Value = c + 1
ElseIf Cells(i, 1) = "Adam NADIM HANBALI" And Cells(i, 20) <= lundimanquant And Cells(i, 19) = "" Then
Worksheets(1).Select
c = Range("G23").Value
Range("G23").Value = c + 1
End If
i = i + 1
Loop