Non exécution d'une macro
Bonjour tout le monde,
Je lance tout les débuts du mois une macro qui me détecte les jours fériés et jours ouvrés par pays, sauf que quand je l'ai lancé aujourd'hui mon calendrier, il n'a pas changé et je n'ai eu aucun message d'erreur. svp aidez moi à trouver l'erreur.
Code:
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
| Sub BankHolidaysPerLigne()
Application.DisplayAlerts = False
Application.EnableEvents = False
Application.ScreenUpdating = False
Application.StatusBar = "Calculating WorkingDays.."
Sheets("WorkingDays").Activate
Do While Worksheets("Data Validation").range("A1").Offset(i, 0) <> "" ' la liste des usines
plant_ = Worksheets("Data Validation").range("A1").Offset(i, 0)
i = i + 1
ActiveSheet.range("$A$3:$DN$10000").AutoFilter Field:=1, Criteria1:=plant_ ' filtrer par usine
ligne = 5
Do While range("A:A").Rows(ligne).Hidden
ligne = ligne + 1
Loop
If range("A" & ligne) <> "" Then 'si la cellule de l'usine n'est pas vide on applique la formule
range("P" & ligne).FormulaR1C1 = "=1-IF(WEEKDAY(R2C,2)>5,1,COUNTIFS(BankHolidays!C3,WorkingDays!R2C,BankHolidays!C2,WorkingDays!RC1))" 'recherche par usine et par jour les jours fériés
range("P" & ligne).AutoFill Destination:=range("P" & ligne & ":AT" & ligne), Type:=xlFillDefault
range("P" & ligne & ":AT" & ligne).Copy
DL = Cells(Application.Rows.Count, 1).End(xlUp).Row
range("P" & ligne & ":AT" & DL).SpecialCells(xlCellTypeVisible).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
End If
Loop
Selection.AutoFilter
Application.DisplayAlerts = True
Application.EnableEvents = True
Application.ScreenUpdating = True
Application.StatusBar = False
End Sub |