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
| Option Explicit
Sub TestOnOff(ByVal App As String, ByVal Etat As Boolean)
Dim LastLig As Long, i As Long, j As Long
Dim Tb
With Worksheets("bd")
LastLig = .Cells(.Rows.Count, "B").End(xlUp).Row
Tb = .Range("C2:G" & LastLig)
For i = 1 To LastLig - 1
If InStr("JI|ADF", Tb(i, 4)) Then
If Not Etat Then
If Tb(i, 5) = App Then Tb(i, 5) = ""
Else
If Tb(i, 5) = "" Then
For j = 1 To LastLig - 1
If Tb(j, 5) = App And Tb(j, 1) & "|" & Tb(j, 2) & "|" & Int(Tb(j, 3)) = Tb(i, 1) & "|" & Tb(i, 2) & "|" & Int(Tb(i, 3)) Then Tb(i, 5) = App
Next j
End If
End If
End If
Next i
.Range("C2:G" & LastLig) = Tb
End With
End Sub |
Partager