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 40 41 42 43 44 45 46 47 48 49 50 51 52
| Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$E$12" Then
Dim colonne
Dim Ligne As String
Cells.EntireRow.Hidden = False
If Cells(12, 5) = "TVA" Then
colonne = 2
ElseIf Cells(12, 5) = "Taxe Pro" Then
colonne = 3
ElseIf Cells(12, 5) = "Paie" Then
colonne = 4
ElseIf Cells(12, 5) = "IS" Then
colonne = 5
End If
For i = 2 To Range("A" & Rows.Count).End(xlUp).Row
If Cells(13, 5) = "" And Cells(14, 5) = "" And Cells(15, 5) = "" Then
Ligne = Ligne & "," & i & ":" & i
ElseIf Cells(13, 5) <> "" And Cells(14, 5) = "" And Cells(15, 5) = "" Then
If Cells(i, colonne) <> "" Then Ligne = Ligne & "," & i & ":" & i
ElseIf Cells(13, 5) = "" And Cells(14, 5) <> "" And Cells(15, 5) = "" Then
If UCase(Cells(i, colonne)) <> "X" Then Ligne = Ligne & "," & i & ":" & i
ElseIf Cells(13, 5) = "" And Cells(14, 5) = "" And Cells(15, 5) <> "" Then
If UCase(Cells(i, colonne)) <> "NA" Then Ligne = Ligne & "," & i & ":" & i
ElseIf Cells(13, 5) <> "" And Cells(14, 5) <> "" And Cells(15, 5) = "" Then
If Cells(i, colonne) <> "" And UCase(Cells(i, colonne)) <> "X" Then Ligne = Ligne & "," & i & ":" & i
ElseIf Cells(13, 5) = "" And Cells(14, 5) <> "" And Cells(15, 5) <> "" Then
If UCase(Cells(i, colonne)) <> "X" And UCase(Cells(i, colonne)) <> "NA" Then Ligne = Ligne & "," & i & ":" & i
ElseIf Cells(13, 5) <> "" And Cells(14, 5) = "" And Cells(15, 5) <> "" Then
If Cells(i, colonne) <> "" And UCase(Cells(i, colonne)) <> "NA" Then Ligne = Ligne & "," & i & ":" & i
ElseIf Cells(13, 5) <> "" And Cells(14, 5) <> "" And Cells(15, 5) <> "" Then
If Cells(i, colonne) <> "" And UCase(Cells(i, colonne)) <> "X" And UCase(Cells(i, colonne)) <> "NA" Then Ligne = Ligne & "," & i & ":" & i
End If
Next
Ligne = Mid(Ligne, 2)
If Ligne <> "" Then
Range(Ligne).EntireRow.Hidden = True
End If
End If
End Sub |
Partager