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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920
| Private Sub CommandButton1_Click()
'on passe en revue tous les contrôles du formulaire
For Each ctrl In UserForm1.Controls
'si le controle en cours de traitement est une case à cocher
If TypeName(ctrl) = "CheckBox" Then
'Si la case est cochée
If ctrl.Value = True Then 'Si coché ...
'Ici mon code
Dim Processus As String
'Activation et déprotection de la feuille nommée Synthese par processus
Sheets("Synthese par processus").Activate
ActiveSheet.Unprotect
' Masquage du déroulé de la macro
'Application.ScreenUpdating = False
'Défusionne Date prochain audit en F31
Range("F31:H31").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Selection.UnMerge
'Défusionne Colonne M:N 43 à 68 de la liste des documents par statut
Range("M43:N47,M50:N54,M57:N61,M64:N68").Select
Range("M64").Activate
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.UnMerge
'Effacement des données de la feuille
Sheets("Synthese par processus").Unprotect
Range("B5:E7").ClearContents
Range("B10:B15").ClearContents
Range("B18:B23").ClearContents
Range("B26:B29").ClearContents
Range("F10:L15").ClearContents
Range("F18:L22").ClearContents
Range("F31").ClearContents
Range("G31").ClearContents
Range("I31").ClearContents
Range("D35:N41").ClearContents
Range("N31").ClearContents
Range("D43:M47").ClearContents
Range("D50:M54").ClearContents
Range("D57:M61").ClearContents
Range("D64:M68").ClearContents
Range("D25:N29").ClearContents
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
Selection.Borders(xlEdgeBottom).LineStyle = xlNone
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
With Selection.Interior
.Pattern = xlNone
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Selection.FormatConditions.Delete
Range("A2:N2").ClearContents
'Défusionne ligne D26 à N26
Range("D26:N26").Font.Bold = False
With Selection.Font
.ColorIndex = xlAutomatic
.TintAndShade = 0
End With
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Selection.UnMerge
Selection.ClearContents
'Défusionne Tableau des actions en retard
Range("F35:N41").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Selection.UnMerge
'Inscrit le processus choisi dans le MsgBox en cellule A2 et en majuscule grace au UCase
Processus = ucase(InputBox("Veuillez saisir le processus à extraire :" & Chr$(13) & Chr$(13) & "Liste des processus :" & Chr$(13) & Chr$(13) & "M10 - M11 - M20 - M21 - M30 - M31 - M40 - M41 - M42 - M43" & Chr$(13) & Chr$(13) & "P10 - P11 - P12 - P13 - P20 - P21 - P22 - P23 - P30 - P31 - P32 - P40 - P41 - P42" & Chr$(13) & Chr$(13) & "S10 - S20 - S21 - S22 - S30 - S40 - S50" & Chr$(13) & Chr$(13) & Chr$(13) & Chr$(13) & "ATTENTION : la saisie est obligatoire.", "PROCESSUS"))
Range("A2").FormulaR1C1 = Processus
'Inscrit en B5 l'intitulé du processus sauf si A2 est vide
Range("B5").FormulaR1C1 = _
"=IF(ISBLANK(R2C1),"""",VLOOKUP(R2C1,Links!C[-1]:C[2],2,FALSE))"
'Inscrit en B6 l'identité du pilote du processus sauf si A2 est vide
Range("B6").FormulaR1C1 = _
"=IF(ISBLANK(R2C1),"""",VLOOKUP(R2C1,Links!C[-1]:C[2],3,FALSE))"
'Inscrit en B7 l'@mail cliquable du pilote du processus + Titre du mail sauf si A2 est vide
Range("B7").FormulaR1C1 = _
"=IF(ISBLANK(R2C1),"""",HYPERLINK(""mailto:""&VLOOKUP(R2C1,Links!C[-1]:C[2],4,FALSE)&""?subject=Titre du mail&cc=mail en copie&bcc=mail copie caché"",VLOOKUP(R2C1,Links!C[-1]:C[2],4,FALSE)))"
'Inscrit de B10 à B15 les données du référentiel documentaire sauf si A2 est vide
Range("B10").FormulaR1C1 = _
"=IF(ISBLANK(R2C1),"""",VLOOKUP(R2C1,OFFSET(Accueil!R6C18,0,IF(LEFT(R2C1)=""M"",0,IF(LEFT(R2C1)=""P"",7,14)),20,7),MATCH(RC1,Accueil!R6C18:R6C38,0),FALSE))"
Range("B11").FormulaR1C1 = _
"=IF(ISBLANK(R2C1),"""",VLOOKUP(R2C1,OFFSET(Accueil!R6C18,0,IF(LEFT(R2C1)=""M"",0,IF(LEFT(R2C1)=""P"",7,14)),20,7),MATCH(RC1,Accueil!R6C18:R6C38,0),FALSE))"
Range("B12").FormulaR1C1 = _
"=IF(ISBLANK(R2C1),"""",VLOOKUP(R2C1,OFFSET(Accueil!R6C18,0,IF(LEFT(R2C1)=""M"",0,IF(LEFT(R2C1)=""P"",7,14)),20,7),MATCH(RC1,Accueil!R6C18:R6C38,0),FALSE))"
Range("B13").FormulaR1C1 = _
"=IF(ISBLANK(R2C1),"""",VLOOKUP(R2C1,OFFSET(Accueil!R6C18,0,IF(LEFT(R2C1)=""M"",0,IF(LEFT(R2C1)=""P"",7,14)),20,7),MATCH(RC1,Accueil!R6C18:R6C38,0),FALSE))"
Range("B14").FormulaR1C1 = _
"=IF(ISBLANK(R2C1),"""",VLOOKUP(R2C1,OFFSET(Accueil!R6C18,0,IF(LEFT(R2C1)=""M"",0,IF(LEFT(R2C1)=""P"",7,14)),20,7),MATCH(RC1,Accueil!R6C18:R6C38,0),FALSE))"
Range("B15").FormulaR1C1 = _
"=IF(ISBLANK(R2C1),"""",VLOOKUP(R2C1,OFFSET(Accueil!R6C18,0,IF(LEFT(R2C1)=""M"",0,IF(LEFT(R2C1)=""P"",7,14)),20,7),MATCH(RC1,Accueil!R6C18:R6C38,0),FALSE))"
'Inscrit de B18 à B23 les données du plan d action d amelioration du processus sauf si A2 est vide
Range("B18").FormulaR1C1 = _
"=IF(ISBLANK(R2C1),"""",VLOOKUP(R2C1,OFFSET(Accueil!R27C18,0,IF(LEFT(R2C1)=""M"",0,IF(LEFT(R2C1)=""P"",7,14)),20,7),MATCH(RC1,Accueil!R27C18:R27C38,0),FALSE))"
Range("B19").FormulaR1C1 = _
"=IF(ISBLANK(R2C1),"""",VLOOKUP(R2C1,OFFSET(Accueil!R27C18,0,IF(LEFT(R2C1)=""M"",0,IF(LEFT(R2C1)=""P"",7,14)),20,7),MATCH(RC1,Accueil!R27C18:R27C38,0),FALSE))"
Range("B20").FormulaR1C1 = _
"=IF(ISBLANK(R2C1),"""",VLOOKUP(R2C1,OFFSET(Accueil!R27C18,0,IF(LEFT(R2C1)=""M"",0,IF(LEFT(R2C1)=""P"",7,14)),20,7),MATCH(RC1,Accueil!R27C18:R27C38,0),FALSE))"
Range("B21").FormulaR1C1 = _
"=IF(ISBLANK(R2C1),"""",VLOOKUP(R2C1,OFFSET(Accueil!R27C18,0,IF(LEFT(R2C1)=""M"",0,IF(LEFT(R2C1)=""P"",7,14)),20,7),MATCH(RC1,Accueil!R27C18:R27C38,0),FALSE))"
Range("B22").FormulaR1C1 = _
"=IF(ISBLANK(R2C1),"""",VLOOKUP(R2C1,OFFSET(Accueil!R27C18,0,IF(LEFT(R2C1)=""M"",0,IF(LEFT(R2C1)=""P"",7,14)),20,7),MATCH(RC1,Accueil!R27C18:R27C38,0),FALSE))"
Range("B23").FormulaR1C1 = _
"=IF(ISBLANK(R2C1),"""",VLOOKUP(R2C1,OFFSET(Accueil!R27C18,0,IF(LEFT(R2C1)=""M"",0,IF(LEFT(R2C1)=""P"",7,14)),20,7),MATCH(RC1,Accueil!R27C18:R27C38,0),FALSE))"
'Inscrit en B26 le nombre d'audit réalisé en fonction de la liste deroulante des année en A27 sauf si A2 est vide
Range("B26").FormulaR1C1 = _
"=IF(ISBLANK(R2C1),"""",COUNTIFS('Planning Audits'!R2C1:R100C1,R2C1,'Planning Audits'!R2C23:R100C23,""Audit réalisé"",'Planning Audits'!R2C5:R100C5,RC[-1]))"
'Inscrit en B27 le nombre d'audit réalisé en fonction de la liste deroulante des année en A27 sauf si A2 est vide
Range("B27").FormulaR1C1 = _
"=IF(ISBLANK(R2C1),"""",COUNTIFS('Planning Audits'!R2C1:R100C1,R2C1,'Planning Audits'!R2C23:R100C23,""Audit réalisé"",'Planning Audits'!R2C5:R100C5,RC[-1]))"
'Inscrit en B28 le nombre d'audit réalisé en fonction de la liste deroulante des année en A27 sauf si A2 est vide
Range("B28").FormulaR1C1 = _
"=IF(ISBLANK(R2C1),"""",COUNTIFS('Planning Audits'!R2C1:R100C1,R2C1,'Planning Audits'!R2C23:R100C23,""Audit réalisé"",'Planning Audits'!R2C5:R100C5,RC[-1]))"
'Inscrit en B29 le nombre d'audit réalisé en fonction de la liste deroulante des année en A27 sauf si A2 est vide
Range("B29").FormulaR1C1 = _
"=IF(ISBLANK(R2C1),"""",COUNTIFS('Planning Audits'!R2C1:R100C1,R2C1,'Planning Audits'!R2C23:R100C23,""Audit réalisé"",'Planning Audits'!R2C5:R100C5,RC[-1]))"
'Création tableau des fiches de progres en D25 sauf si A2 est vide
Sheets("Fiche de Progres").Select
ActiveSheet.Unprotect
Rows("1:1").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Rows("4:4").Copy
Rows("1:1").Select
ActiveSheet.Paste
Range("F2").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = Processus
Range("A4:W503").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
Range("A1:W2"), Unique:=False
Range("A4:A504").Copy
Sheets("Synthese par processus").Select
Range("P25").Select
ActiveSheet.Paste
Sheets("Fiche de Progres").Select
' Range("e4:e504").Copy
' Sheets("Synthese par processus").Select
' Range("Q25").Select
' ActiveSheet.Paste
' Sheets("Fiche de Progres").Select
Range("G4:H504").Copy
Sheets("Synthese par processus").Select
Range("Q25").Select
ActiveSheet.Paste
Sheets("Fiche de Progres").Select
Range("K4:O504").Copy
Sheets("Synthese par processus").Select
Range("S25").Select
ActiveSheet.Paste
Sheets("Fiche de Progres").Select
Range("R4:T504").Copy
Sheets("Synthese par processus").Select
Range("X25").Select
ActiveSheet.Paste
Sheets("Fiche de Progres").Select
ActiveSheet.ShowAllData
Rows("1:3").Delete Shift:=xlUp
Range("A1").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Sheets("Synthese par processus").Select
'Mise en page tableau FP
Range("P25:Z29").Select
Selection.Font.Bold = False
Selection.Font.Size = 8
Range("U25").FormulaR1C1 = "Fin de Traitement"
Range("V25").FormulaR1C1 = "Temps restant"
Columns("P:X").ColumnWidth = 10
Columns("Y:Y").ColumnWidth = 5
Columns("Z:Z").ColumnWidth = 8
Range("P25:Z29").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
'Message indiquant en D26 Aucune Fiche de progrès concernant ce processus si D26 est vide
If Range("P26").Value = "" Then
Range("P26").Value = "Aucune Fiche de Progrès concernant votre processus"
Range("P26:Z26").Merge
Range("P26").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
With Selection.Font
.Color = -16776961
.TintAndShade = 0
End With
Selection.Font.Bold = True
Range("P26:Z26").Select
Selection.Font.Size = 10
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
With Selection.Font
.Color = -16776961
.TintAndShade = 0
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Selection.Font.Bold = True
End If
'Coupe/colle en D25 le tableau des FP
Range("P25:Z30").Cut
Range("D25").Select
ActiveSheet.Paste
'Inscrit en N31 si oui ou non une revue de processus a été planifiée sauf si A2 est vide
Range("N31").FormulaR1C1 = _
"=IF(ISBLANK(R2C1),"""",VLOOKUP(R2C1,Accueil!R[-26]C[33]:R35C48,2,FALSE))"
'Inscrit en F31 la prochaine période d audit
Range("F31").FormulaArray = _
"=IFERROR(INDEX(""du "" & TEXT(Audit[Date Début], ""jj/mm/aaaa"") & "" au "" & TEXT(Audit[Date Fin], ""jj/mm/aaaa""), MIN(IF((ISBLANK(Audit[Date Clôture])) * (Audit[Processus]=R2C1), ROW(Audit[Date Début]) - ROW(Audit[[#Headers],[Date Début]]), 10000000))), """")"
'Extraction du nombre de documents par types par catégories
Range("F10").FormulaR1C1 = _
"=IF(ISBLANK(R2C1),"""",COUNTIFS('Suivi Referentiel documentaire'!C1,R2C1,'Suivi Referentiel documentaire'!C4,R9C,'Suivi Referentiel documentaire'!C6,RC5))"
Range("F10").AutoFill Destination:=Range("F10:F13"), Type:=xlFillDefault
Range("F10:F13").AutoFill Destination:=Range("F10:L13"), Type:=xlFillDefault
Range("F13").AutoFill Destination:=Range("F13:F14"), Type:=xlFillDefault
Range("F14").FormulaR1C1 = _
"=IF(ISBLANK(R2C1),"""",COUNTIFS('Suivi Referentiel documentaire'!C1,R2C1,'Suivi Referentiel documentaire'!C4,R9C))"
Range("F14").AutoFill Destination:=Range("F14:L14"), Type:=xlFillDefault
Range("F15:L15").FormulaR1C1 = _
"=IF(ISBLANK(R2C1),"""",IF(ISERROR(R[-5]C/(R[-1]C-R[-2]C)),"""",(R[-5]C/(R[-1]C-R[-2]C))))"
Range("F15").AutoFill Destination:=Range("F15:L15"), Type:=xlFillDefault
'MEFC Valeur à zéro, Police blanche
Range("F10:L14").Select
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
Formula1:="=0"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Font
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
'Extraction des n° d actions du plan d amelioration du processus
Range("F18").FormulaArray = _
"=IFERROR(INDEX(Tab_Action[N°], SMALL(IF((Tab_Action[Statut]=RC5) * (Tab_Action[Processus]=R2C1), ROW(Tab_Action[N°]) - ROW(Tab_Action[[#Headers],[N°]]), 10000000), COLUMN()-COLUMN(RC5))), """")"
Range("F19").FormulaArray = _
"=IFERROR(INDEX(Tab_Action[N°], SMALL(IF((Tab_Action[Statut]=""En cours"") * (Tab_Action[Processus]=R2C1) * (Tab_Action[Retard] <> ""Aucun""), ROW(Tab_Action[N°]) - ROW(Tab_Action[[#Headers],[N°]]), 10000000), COLUMN()-COLUMN(RC5))), """")"
Range("F20").FormulaArray = _
"=IFERROR(INDEX(Tab_Action[N°], SMALL(IF((Tab_Action[Statut]=RC5) * (Tab_Action[Processus]=R2C1), ROW(Tab_Action[N°]) - ROW(Tab_Action[[#Headers],[N°]]), 10000000), COLUMN()-COLUMN(RC5))), """")"
Range("F21").FormulaArray = _
"=IFERROR(INDEX(Tab_Action[N°], SMALL(IF((Tab_Action[Statut]=RC5) * (Tab_Action[Processus]=R2C1), ROW(Tab_Action[N°]) - ROW(Tab_Action[[#Headers],[N°]]), 10000000), COLUMN()-COLUMN(RC5))), """")"
Range("F22").FormulaArray = _
"=IFERROR(INDEX(Tab_Action[N°], SMALL(IF((Tab_Action[Statut]=""En cours"") * (Tab_Action[Processus]=R2C1) * (Tab_Action[Retard]= ""Aucun""), ROW(Tab_Action[N°]) - ROW(Tab_Action[[#Headers],[N°]]), 10000000), COLUMN()-COLUMN(RC5))), """")"
Range("F18:F22").AutoFill Destination:=Range("F18:L22"), Type:=xlFillDefault
Range("E23").Select
'Extraction du point de situation et des échéances des actions en retard du plan d amelioration du processus
Range("D35").FormulaArray = _
"=IFERROR(INDEX(Tab_Action[N°], SMALL(IF((Tab_Action[Statut]=""En cours"") * (Tab_Action[Processus]=R2C1) * (Tab_Action[Retard] <> ""Aucun""), ROW(Tab_Action[N°]) - ROW(Tab_Action[[#Headers],[N°]]), 10000000), ROW()-ROW(R34C4))), """")"
Range("E35").FormulaArray = _
"=IFERROR(INDEX(Tab_Action[Échéance], SMALL(IF((Tab_Action[Statut]=""En cours"") * (Tab_Action[Processus]=R2C1) * (Tab_Action[Retard] <> ""Aucun""), ROW(Tab_Action[N°]) - ROW(Tab_Action[[#Headers],[N°]]), 10000000), ROW()-ROW(R34C4))), """")"
Range("F35").FormulaArray = _
"=IFERROR(INDEX(Tab_Action[Point de situation], SMALL(IF((Tab_Action[Statut]=""En cours"") * (Tab_Action[Processus]=R2C1) * (Tab_Action[Retard] <> ""Aucun""), ROW(Tab_Action[N°]) - ROW(Tab_Action[[#Headers],[N°]]), 10000000), ROW()-ROW(R34C4))), """")"
Range("D35:F35").AutoFill Destination:=Range("D35:F41"), Type:=xlFillDefault
Range("F35:N35").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
Range("F36:N36").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
Range("F37:N37").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
Range("F38:N38").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
Range("F39:N39").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
Range("F40:N40").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
Range("F41:N41").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
Range("F35:N41").Select
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
End With
Range("F35:N41").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
'Extraction des N° de documents en fonction de leur statut d apres la liste déroulante
Range("D43").FormulaArray = _
"=IFERROR(INDEX(Tab_Doc[N° Documents], SMALL(IF((Tab_Doc[Statut]=R42C4) * (Tab_Doc[Processus]=R2C1), ROW(Tab_Doc[N° Documents]) - ROW(Tab_Doc[[#Headers],[N° Documents]]), 10000000), COLUMN()-COLUMN(R42C4) + 1 + 10 * (ROW() - ROW(R42C4) - 1))), """")"
Range("D43").Select
Selection.Copy
Range("E43:M43").Select
ActiveSheet.Paste
Range("D43:M43").Select
Application.CutCopyMode = False
Selection.Copy
Range("D44:M47").Select
ActiveSheet.Paste
Range("D50").FormulaArray = _
"=IFERROR(INDEX(Tab_Doc[N° Documents], SMALL(IF((Tab_Doc[Statut]=R49C4) * (Tab_Doc[Processus]=R2C1), ROW(Tab_Doc[N° Documents]) - ROW(Tab_Doc[[#Headers],[N° Documents]]), 10000000), COLUMN()-COLUMN(R42C4) + 1 + 10 * (ROW() - ROW(R49C4) - 1))), """")"
Range("D50").Select
Selection.Copy
Range("E50:M50").Select
ActiveSheet.Paste
Range("D50:M50").Select
Application.CutCopyMode = False
Selection.Copy
Range("D51:M54").Select
ActiveSheet.Paste
Range("D57").FormulaArray = _
"=IFERROR(INDEX(Tab_Doc[N° Documents], SMALL(IF((Tab_Doc[Statut]=R56C4) * (Tab_Doc[Processus]=R2C1), ROW(Tab_Doc[N° Documents]) - ROW(Tab_Doc[[#Headers],[N° Documents]]), 10000000), COLUMN()-COLUMN(R42C4) + 1 + 10 * (ROW() - ROW(R56C4) - 1))), """")"
Range("D57").Select
Selection.Copy
Range("E57:M57").Select
ActiveSheet.Paste
Range("D57:M57").Select
Application.CutCopyMode = False
Selection.Copy
Range("D58:M61").Select
ActiveSheet.Paste
Range("D64").FormulaArray = _
"=IFERROR(INDEX(Tab_Doc[N° Documents], SMALL(IF((Tab_Doc[Statut]=R63C4) * (Tab_Doc[Processus]=R2C1), ROW(Tab_Doc[N° Documents]) - ROW(Tab_Doc[[#Headers],[N° Documents]]), 10000000), COLUMN()-COLUMN(R42C4) + 1 + 10 * (ROW() - ROW(R63C4) - 1))), """")"
Range("D64").Select
Selection.Copy
Range("E64:M64").Select
ActiveSheet.Paste
Range("D64:M64").Select
Application.CutCopyMode = False
Selection.Copy
Range("D65:M68").Select
ActiveSheet.Paste
Range("M43:N43").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
Selection.Copy
Range("M44:N47").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Range("M50:N50").Select
Selection.Copy
Range("M51:M54").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Range("M50:N50").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
Selection.Copy
Range("M51:N54").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Range("M57:N57").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
Selection.Copy
Range("M58:N61").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Range("M64:N64").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
Selection.Copy
Range("M65:N68").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Range("D42:N42").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
'Fusionne les cellules M et N 43 à 68 concernant les N° de documents en fonction de la liste des statuts
Range("M43:N43").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
Selection.Copy
Range("M44:N47").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Range("M50:N50").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
Selection.Copy
Range("M51:N54").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Range("M57:N57").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
Selection.Copy
Range("M58:N61").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Range("M64:N64").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Selection.Merge
Selection.Copy
Range("M65:N68").Select
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Range("M43:N47,M50:N54,M57:N61,M64:N68").Select
Range("M64").Activate
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
'Boite dialogue de confirmation d envoi du mail
Select Case MsgBox("Désirez-vous transmettre cette fiche de synthèse au pilote de processus ?", vbYesNo, "Application développée par Graphikris.")
'Procédure si click sur Oui
Case vbYes
'Création du Pdf
Dim sNomPdf As String
Dim sDossier As String
Dim Destinataire As String
sDossier = ThisWorkbook.Path
'Destinataire = Feuil9.Range("b7")
sNomPdf = sDossier & "\" & "Synthese du processus " & Feuil9.Range("A2") & " _ Extraction du " & _
Replace(Replace(Replace(Left(Now, 16), ":", "h"), " ", " à "), "/", "-") & ".pdf"
Feuil9.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=sNomPdf, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
'Envoi du mail
'Contrôler dans Visual Basic/Outils/Références/que Microsoft Outlook --,- Object Librairy est bien coché
Dim olapp As Outlook.Application
'Contrôle la validité ou la présence d'adresse mail en B7
Dim msg As MailItem
Set olapp = New Outlook.Application
Set msg = olapp.CreateItem(olMailItem)
'Adresse de la cellule contenant la liste des adresses mails
msg.To = Range("B7").Value
'Envoi en copie
msg.CC = " "
'Envoi en copie cachée
msg.BCC = " "
'Saisir le sujet de l'envoi
msg.Subject = "Fiche de synthese du processus " & Feuil9.Range("A2")
'Saisie du message
'Saisir Corps du message
msg.Body = "Inserez votre corps de msg ici."
'Adresse de la pièce jointe
msg.Attachments.Add Source:=sNomPdf
msg.Display
'Transmission du message
msg.Send
'procédure si click sur Non
Case vbNo
'ActiveWindow.Close
rep = MsgBox("Votre courriel ne sera pas transmis.", vbYes + vbInformation, "Annulation transmission de courriel / Application développée par Graphikris.")
End Select
'Procédure de demande d impression
Select Case MsgBox("Désirez-vous imprimer cette fiche de synthèse ?", vbYesNo, "Application développée par Graphikris.")
'procédure si click sur Oui
Case vbYes
NbreCopie = InputBox("Veuillez saisir le nombre de copie à imprimer : " & Chr$(13) & Chr$(13) & "ATTENTION : la saisie est obligatoire.", "Nombre de copie à imprimer")
ActiveWindow.SelectedSheets.PrintOut Copies:=NbreCopie
'procédure si click sur Non
Case vbNo
rep = MsgBox("Annulation de l'impression du document.", vbYes + vbInformation, "Annulation impression / Application développée par Graphikris.")
End Select
'Affichage feuille
Application.ScreenUpdating = True
'Protection de la feuille
ActiveSheet.Protect
Range("A9").Select
End If
End If
Next
End Sub |
Partager