Dim Ftab As Worksheet, DL As Long, DC As Long, Bdd As Range    'ici pour garder les valueurs dans les 2 macros
Dim NDF As String, rep As String
Sub EXTRA()
    Set Ftab = Worksheets("tab")
    Application.ScreenUpdating = False
    DL = Cells(Rows.Count, 1).End(xlUp).Row 'dernière ligne
    DC = Cells(1, Columns.Count).End(xlToLeft).Column    'dernière colonne
    With Ftab
        Set Bdd = .[A1].Resize(DL, DC)    'plage de référence
        Call MAJ1    'appel de cette routine
        'suite
    End With
End Sub
Sub MAJ1()
    Dim P As Range
    With Bdd
        On Error Resume Next
        .Cells.SpecialCells(xlCellTypeFormulas) = ""
        'cas 1
        Set P = .Range("AE2:AE" & DL)
        P.SpecialCells(4).FormulaR1C1 = _
        "=IF(AND(RC8=""agence"",OR(RC6=""Inter"",RC6=""t/s"",RC6=""liens"",RC6=""cdr"")),""wwww"","""")"
        'cas 2
        Set P = .Range("AF2:AF" & DL)
        P.SpecialCells(4).FormulaR1C1 = _
        "=IF(AND(RC8=""agence"",OR(RC6=""Inter"",RC6=""t/s"",RC6=""liens"")),""wwww"","""")"
        'cas 3
        Set P = .Range("AG2:AH" & DL)
        P.SpecialCells(4).FormulaR1C1 = _
        "=IF(AND(RC8=""agence"",OR(RC6=""Inter"",RC6=""t/s"",RC6=""brun"",RC6=""cdr"")),""wwww"","""")"
        Set P = .Range("AL2:AL" & DL)
        P.SpecialCells(4).FormulaR1C1 = _
        "=IF(AND(RC8=""agence"",OR(RC6=""Inter"",RC6=""t/s"",RC6=""brun"",RC6=""cdr"")),""wwww"","""")"
        'cas 4
        Set P = .Range("AI2:AI" & DL)
        P.SpecialCells(4).FormulaR1C1 = _
        "=IF(AND(RC8=""agence"",OR(RC6=""Inter"",RC6=""t/s"",RC6=""brun"",RC6=""liens"",RC6=""cdr"")),""wwww"","""")"
        'cas 5
        Set P = .Range("AJ2:AK" & DL)
        P.SpecialCells(4).FormulaR1C1 = _
        "=IF(AND(RC8=""agence"",OR(RC6=""brun"",RC6=""cdr"")),""wwww"","""")"
        Set P = .Range("AM2:AM" & DL)
        P.SpecialCells(4).FormulaR1C1 = _
        "=IF(AND(RC8=""agence"",OR(RC6=""brun"",RC6=""cdr"")),""wwww"","""")"
    End With
End Sub