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 64 65 66 67 68 69 70 71 72 73 74
| Sub RemplissageTableau()
Application.ScreenUpdating = False
Dim c As Range
Dim EffNec
EffNec = "=IF(OR(RC13=""AGPRO"",RC13=""AGTEC"",RC13=""AGING"",RC13=""AGAPP""),0,RC[-2])"
For I = 11 To Sheets.Count
With Sheets(I)
.Columns("T:U").ClearContents
For Each c In .Range("T1:U" & .Range("S" & Rows.Count).End(xlUp).Row)
c.Formula = EffNec
Next c
End With
Next I
Total
End Sub
__________________________________________
Sub Total()
Dim LastLig As Long, Deb As Long, Fin As Long
Dim T As Double, U As Double
Dim Prem As String
Dim c As Range
For I = 11 To Sheets.Count
With Sheets(I)
LastLig = .Cells(.Rows.Count, 1).End(xlUp).Row
Set c = .Range("B2:B" & LastLig).Find("Total*", LookIn:=xlValues, lookat:=xlPart)
Deb = 2
If Not c Is Nothing Then
Prem = c.Address
Do
Fin = c.Row - 1
.Range("T" & Fin + 1).Formula = "=SUMIF(E" & Deb & ":E" & Fin & ",""<>"",T" & Deb & ":T" & Fin & ")"
.Range("U" & Fin + 1).Formula = "=SUM(U" & Deb & ":U" & Fin & ")"
Deb = Fin + 2
T = T + .Range("T" & Fin + 1)
U = U + .Range("U" & Fin + 1)
Set c = .Range("B2:B" & LastLig).FindNext(c)
Loop While Not c Is Nothing And c.Address <> Prem
End If
.Range("T" & LastLig).Resize(, 2) = Array(T, U)
T = 0
U = 0
End With
Next I
MiseEnForme
End Sub
______________________________
Sub MiseEnForme()
For I = 11 To Sheets.Count
With Sheets(I)
.Columns("E:E").Copy
.Columns("D:V").PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
.Columns("A:V").AutoFit
.Columns("A:Q").HorizontalAlignment = xlLeft
.Columns("T:U").HorizontalAlignment = xlRight
.Columns("R:S").EntireColumn.Hidden = True
.Columns("R:S").EntireColumn.Hidden = True
.Columns("V:V").ColumnWidth = 40
.Columns("L:L").NumberFormat = "m/d/yyyy"
.Columns("H:H").NumberFormat = "m/d/yyyy"
.Columns("O:O").NumberFormat = "m/d/yyyy"
.Columns("Q:Q").NumberFormat = "m/d/yyyy"
.Columns("D:D").EntireColumn.Hidden = True
'Mise en forme Ligne
.Rows("1:1").HorizontalAlignment = xlCenter
.Rows("1:1").VerticalAlignment = xlCenter
End With
Next I
End Sub |
Partager