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 53 54 55 56 57 58 59 60 61 62 63
| Dim Nom As String
Dim Wb As Workbook
Dim NomFeuille As String
Dim ListeFichier(1 To 1000), NbFichiers As Long
Sub ouvrir_fichiers()
Dim i As Long
Application.ScreenUpdating = False
chemin = Range("B4").Value & "\"
NomFeuille = "MaFeuille"
Nom = Dir(chemin)
While Nom <> ""
NbFichiers = NbFichiers + 1
ListeFichier(NbFichiers) = chemin & Nom
Nom = Dir()
Wend
For i = 1 To NbFichiers
Set Wb = Workbooks.Open(ListeFichier(i))
conditionnelle
Wb.Close True
Next i
Application.ScreenUpdating = True
End Sub
Sub conditionnelle()
With Wb.Worksheets(NomFeuille)
With .Range("I5")
.FormatConditions.Add Type:=xlExpression, Formula1:="=ET($D5=""Délai apparent"";I$2<SERIE.JOUR.OUVRE($I$2;$E5))"
.FormatConditions(.FormatConditions.Count).SetFirstPriority
With .FormatConditions(1)
With .Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 16757387
.TintAndShade = 0
.PatternTintAndShade = 0
End With
.StopIfTrue = False
End With
.FormatConditions.Add Type:=xlExpression, Formula1:="=ET($D5=""Délai total"";I$2<SERIE.JOUR.OUVRE($I$2;$E5))"
.FormatConditions(.FormatConditions.Count).SetFirstPriority
With .FormatConditions(1)
With .Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent1
.TintAndShade = 0.599993896298105
.PatternTintAndShade = 0
End With
.StopIfTrue = False
End With
.Copy
End With
.Range("I5:AF6").PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End With
Application.CutCopyMode = False
End Sub |
Partager