Untitled 4/21/2018 11:43:15 PM

<p>Sub AnalyseBlancsVACA() 'Cette macro analyse les candidatures d'un affichage selon l'application de l'article 19.09 'de la convention collective des fonctionnaires municipaux pour les affichages VACA et VPERM 'D&eacute;finition des variables Dim cl1 As Workbook Dim ComptElig As Long Dim comptCandidats As Long Set cl1 = ActiveWorkbook Call Table_No_VACA19_AL3 Call Table_PMED 'Cr&eacute;ation de la feuille Analyse Sheets("Sheet1").Copy Before:=Sheets(1) ActiveSheet.Name = "Analyse" 'Suppression des lignes d'ent&ecirc;te 1 &agrave; 8 provenant de InfoRH Rows("1:8").Select Selection.Delete Shift:=xlUp Range("A65536").End(xlUp).Select Selection.Delete Shift:=xlUp Range("A65536").End(xlUp).Select Selection.Delete Shift:=xlUp Columns("O:P").Select Selection.Delete Shift:=xlToLeft Columns("P:P").Select Range(Selection, Selection.End(xlToRight)).Select Selection.Delete Shift:=xlToLeft 'Columns("O:Q").Select 'Selection.Delete Shift:=xlToLeft 'Ajout / nomme des colonnes pour l'analyse des candidatures et mise en forme Sheets("Sheet1").Select Sheets("Sheet1").Name = "Base" Sheets("Sheet2").Select Sheets("Sheet2").Name = "&Eacute;tape R&eacute;ussie" Sheets("Sheet3").Select Sheets("Sheet3").Name = "Admissibilit&eacute;" Sheets("Sheet4").Select Sheets("Sheet4").Name = "&Eacute;ligibilit&eacute;" Sheets("Analyse").Select Range("O1").Select With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlBottom .WrapText = True .ReadingOrder = xlContext End With ActiveCell.FormulaR1C1 = "Pmed?" With ActiveCell.Characters(Start:=1, Length:=5).Font .Name = "ARIAL" .FontStyle = "Gras" .Size = 10 .Underline = xlUnderlineStyleNone .ColorIndex = 1 End With Range("P1").Select With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlBottom .WrapText = True .ReadingOrder = xlContext End With ActiveCell.FormulaR1C1 = "'12" With ActiveCell.Characters(Start:=1, Length:=2).Font .Name = "ARIAL" .FontStyle = "Gras" .Size = 10 .Underline = xlUnderlineStyleNone .ColorIndex = 1 End With Range("Q1").Select With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlBottom .WrapText = True .ReadingOrder = xlContext End With ActiveCell.FormulaR1C1 = "P%?" With ActiveCell.Characters(Start:=1, Length:=3).Font .Name = "ARIAL" .FontStyle = "Gras" .Size = 10 .Underline = xlUnderlineStyleNone .ColorIndex = 1 End With Range("R1").Select With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlBottom .WrapText = True .ReadingOrder = xlContext End With ActiveCell.FormulaR1C1 = "T%?" With ActiveCell.Characters(Start:=1, Length:=3).Font .Name = "ARIAL" .FontStyle = "Gras" .Size = 10 .Underline = xlUnderlineStyleNone .ColorIndex = 1 End With Range("S1").Select With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlBottom .WrapText = True .ReadingOrder = xlContext End With ActiveCell.FormulaR1C1 = "recherchev(stxt(" With ActiveCell.Characters(Start:=1, Length:=16).Font .Name = "ARIAL" .FontStyle = "Gras" .Size = 10 .Underline = xlUnderlineStyleNone .ColorIndex = 1 End With 'D&eacute;termine le num&eacute;ro de service &eacute;quivalent &agrave; l'acronyme inscrit dans le num&eacute;ro d'affichage Sheets("Base").Select Range("A3:Q3").Select Sheets("Analyse").Select ActiveCell.FormulaR1C1 = _ "=VLOOKUP(MID(Base!R[2]C[-18],40,FIND(""-"",Base!R[2]C[-18])-40),ACCRO,2,FALSE)" Range("T1").Select ActiveCell.FormulaR1C1 = _ "=MID(Base!R[2]C[-19],40+LEN(MID(Base!R[2]C[-19],40,FIND(""-"",Base!R[2]C[-19])-40))+5+(IF(ISERROR(FIND(""VPERM"",Base!R[2]C[-19])),4,5)),6)" Range("U1").Select With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlBottom .WrapText = True .ReadingOrder = xlContext .MergeCells = False End With ActiveCell.FormulaR1C1 = "Qualifi&eacute;?" With ActiveCell.Characters(Start:=1, Length:=9).Font .Name = "ARIAL" .FontStyle = "Gras" .Size = 10 .Underline = xlUnderlineStyleNone .ColorIndex = 1 End With Range("V1").Select With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlBottom .WrapText = True .ReadingOrder = xlContext .MergeCells = False End With ActiveCell.FormulaR1C1 = "Annexe L-3" With ActiveCell.Characters(Start:=1, Length:=10).Font .Name = "ARIAL" .FontStyle = "Gras" .Size = 10 .Underline = xlUnderlineStyleNone .ColorIndex = 1 End With Range("W1").Select With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlBottom .WrapText = True .ReadingOrder = xlContext .MergeCells = False End With ActiveCell.FormulaR1C1 = "Concatener" With ActiveCell.Characters(Start:=1, Length:=7).Font .Name = "ARIAL" .FontStyle = "Gras" .Size = 10 .Underline = xlUnderlineStyleNone .ColorIndex = 1 End With Range("X1").Select With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlBottom .WrapText = True .ReadingOrder = xlContext .MergeCells = False End With ActiveCell.FormulaR1C1 = "&Eacute;tape 8" With ActiveCell.Characters(Start:=1, Length:=5).Font .Name = "ARIAL" .FontStyle = "Gras" .Size = 10 .Underline = xlUnderlineStyleNone .ColorIndex = 1 End With Range("Y1").Select With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlBottom .WrapText = True .ReadingOrder = xlContext .MergeCells = False End With ActiveCell.FormulaR1C1 = "&Eacute;tape" With ActiveCell.Characters(Start:=1, Length:=7).Font .Name = "ARIAL" .FontStyle = "Gras" .Size = 10 .Underline = xlUnderlineStyleNone .ColorIndex = 1 End With 'D&eacute;fini le nombre de ligne &agrave; consid&eacute;rer dans l'onglet &Eacute;ligibilit&eacute; Sheets("&Eacute;ligibilit&eacute;").Select ComptElig = ActiveSheet.UsedRange.Rows.Count - 2 Range("G8").Select With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlBottom .WrapText = True .ReadingOrder = xlContext .MergeCells = False End With ActiveCell.FormulaR1C1 = "Concatener" With ActiveCell.Characters(Start:=1, Length:=10).Font .Name = "Arial" .FontStyle = "Gras" .Size = 10 .Underline = xlUnderlineStyleNone .ColorIndex = 1 End With 'Concatenation du numero de matricule candidat et du code d'emploi du BAEL 'pour cr&eacute;er une table de recherche Range("G9").Select Range("G9:G" &amp; ComptElig).Formula = "=CONCATENATE(RC[-6],RC[-3])" ActiveWorkbook.Names.Add Name:="ELIG", RefersToR1C1:= _ "=&Eacute;ligibilit&eacute;!R8C7:R" &amp; ComptElig &amp; "C7" 'D&eacute;but de l'analyse des candidatures selon les crit&egrave;res de chacune des colonnes 'ajout&eacute;es &agrave; la feuille Analyse Sheets("Analyse").Select comptCandidats = ActiveSheet.UsedRange.Rows.Count - 2 'V&eacute;rifie si le candidat a un statut PMED inclus 6017 MESS Range("O2:O" &amp; comptCandidats).Formula = "=IF(OR(LEFT(RC[-7],4)=""6017"",LEFT(RC[-3],4)=""6017""),TRUE,IF(ISERROR(AND(RC[-12]=""PMED"",VLOOKUP(RC[-10],'Table PMED'!R2C1:R400C3,3,FALSE)=VLOOKUP(Analyse!R1C20,'Table PMED'!R2C1:R400C3,3,FALSE))),FALSE,AND(RC[-12]=""PMED"",VLOOKUP(RC[-10],'Table PMED'!R2C1:R400C3,3,FALSE)=VLOOKUP(Analyse!R1C20,'Table PMED'!R2C1:R400C3,3,FALSE))))" 'V&eacute;rifie si le candidat est dans l'accr&eacute;ditation 12 Range("P2:P" &amp; comptCandidats).Formula = "=R1C16=RC[-9]" 'V&eacute;rifie si le candidat est permanent Range("Q2:Q" &amp; comptCandidats).Formula = "=LEFT(RC[-14],1)=""P""" 'V&eacute;rifie si le candidat est auxiliaire Range("R2:R" &amp; comptCandidats).Formula = "=AND(LEFT(RC[-15],1)=""T"",RC[-15]&lt;&gt;""TETU"")" 'V&eacute;rifie si le candidat est employ&eacute; du service/arrondissement vis&eacute; &agrave; l'affichage. Inclus DC (6004) et FIN(04) ensemble Range("S2:S" &amp; comptCandidats).Formula = "=OR(LEFT(RC[-11],2)=R1C,AND(RC[-10]=R1C[1],LEFT(RC[-7],2)=R1C),AND(LEFT(RC[-11],2)=""04"",R1C=""60""),AND(RC[-10]=R1C[1],LEFT(RC[-7],2)=""04"",R1C=""60""),AND(LEFT(RC[-11],4)=""6004"",R1C=""04""),AND(RC[-10]=R1C[1],LEFT(RC[-7],4)=""6004"",R1C=""04""))" 'V&eacute;rifie si l'emploi de r&eacute;f&eacute;rence du candidat est le m&ecirc;me que l'emploi de l'affichage Range("T2:T" &amp; comptCandidats).Formula = "=R1C20=RC[-15]" 'V&eacute;rifie si le candidat est qualifi&eacute; pour l'emploi vis&eacute; &agrave; l'affichage Range("U2:U" &amp; comptCandidats).Formula = _ "=IF(ISERROR(VLOOKUP(CONCATENATE(RC[-20],R1C20),ELIG,1,FALSE)),FALSE,TRUE)" 'V&eacute;rifie si l'emploi de r&eacute;f&eacute;rence du candidat est un emploi de mut interemplois L3 Range("V2:V" &amp; comptCandidats).Formula = _ "=IF(ISERROR(VLOOKUP(CONCATENATE(Analyse!RC[-17],Analyse!R1C20),Table!R25C5:R47C5,1,FALSE)),FALSE,TRUE)" Columns("V:V").Select Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False 'Compile l'ensemble des crit&egrave;res auquels r&eacute;pondent chacun des candidats Range("W2:W" &amp; comptCandidats).Formula = _ "=CONCATENATE(RC[-7],RC[-6],RC[-5],RC[-4],RC[-3],RC[-2],RC[-1])" Columns("W:W").EntireColumn.AutoFit 'Analyse si les candidats r&eacute;pondent aux crit&egrave;res des &eacute;tapes de l'article 19.09 c.c. Range("X2:X" &amp; comptCandidats).Formula = "=OR(CONCATENATE(RC[-8],RC[-3])=""FAUXVRAI"",AND(RC[-21]=""TETU"",RC[-3]))" Sheets("Analyse").Select Range("Y2").Select Range("Y2:Y" &amp; comptCandidats).Formula = _ "=IF(AND(RC[-10]=TRUE,LEFT(RC[-17],4)=""6017""),""&Eacute;tape 2 - PMED MESS"",IF(RC[-10]=TRUE,""&Eacute;tape 2 - PMED du m&ecirc;me groupe de traitement"",IF(ISERROR(VLOOKUP(RC[-2],ETAPE2,2,FALSE)),IF(RC[-1]=TRUE,""&Eacute;tape 8 - Tout autre candidat qualifi&eacute;"",""N/A""),VLOOKUP(RC[-2],ETAPE2,2,FALSE))))" Range("Y1").Select Range("D2").Select ActiveWindow.FreezePanes = True Range("D1").Select 'ICI Range("A1: Y" &amp; comptCandidats).Sort Key1:=Range("Y1"), Order1:=xlAscending, Header:= _ xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _ DataOption1:=xlSortNormal Columns("Y:Y").Select Selection.ColumnWidth = 22.57 With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlBottom .WrapText = True .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With 'ajoute colonne commentaires Range("Z1").Select ActiveCell.FormulaR1C1 = "Commentaires" With ActiveCell.Characters(Start:=1, Length:=12).Font .Name = "ARIAL" .FontStyle = "Gras" .Size = 10 .Underline = xlUnderlineStyleNone .ColorIndex = 1 End With 'ajoute le courriel Range("AA1").Select ActiveCell.FormulaR1C1 = "Courriel" With ActiveCell.Characters(Start:=1, Length:=8).Font .Name = "ARIAL" .FontStyle = "Gras" .Size = 10 .Underline = xlUnderlineStyleNone .ColorIndex = 1 End With Range("AA2:AA" &amp; comptCandidats).Formula = "=VLOOKUP(RC[-26],base!C[-26]:C[-10],17,FALSE)" Columns("AA:AA").Select Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Columns("AA:AA").EntireColumn.AutoFit Application.CutCopyMode = False 'Renomme chacune des feuilles selon leurs noms finaux Sheets("Base").Select Sheets("Base").Name = "Original" Sheets("Admissibilit&eacute;").Select Sheets("Admissibilit&eacute;").Name = "Admiss ant&eacute;rieure" Sheets("&Eacute;ligibilit&eacute;").Select Sheets("&Eacute;ligibilit&eacute;").Name = "Privil&egrave;ge Qual" 'Ajout d'un onglet et import du tableau d&eacute;taill&eacute; de l'article 19.09 Sheets("Analyse").Select Sheets.Add ActiveSheet.Name = "Article 19" Workbooks.Open FileName:=Proc&eacute;dureEmploi Windows("Proc&eacute;dureEmploi.xls").Activate Cells.Select Selection.Copy cl1.Activate ActiveSheet.Paste Windows("Proc&eacute;dureEmploi.xls").Activate Application.CutCopyMode = False ActiveWindow.Close Rows("8:9").Select Application.CutCopyMode = False Selection.Delete Shift:=xlUp Range("B6").Select ActiveCell.FormulaR1C1 = _ "=RIGHT(Original!R[-3]C[-1],LEN(Original!R[-3]C[-1])-39)" Sheets("Analyse").Select Range("T1").Select Selection.Copy Sheets("Article 19").Select Range("C6").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Range("B7").Select ActiveCell.FormulaR1C1 = _ "=IF(ISERROR(VLOOKUP(R[-1]C[1],'Table PMED'!R[-5]C[-1]:R[393]C,1,FALSE)),"""",VLOOKUP(R[-1]C[1],'Table PMED'!R[-6]C[-1]:R[393]C[1],2,FALSE))" Range("B8").Select Cells.Select Application.CutCopyMode = False Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Range("A5").Select 'Compte le nombre de candidats r&eacute;pondant &agrave; chacune des &eacute;tapes dans la feuille Analyse Sheets("Analyse").Select Range("Y2:Y108").Select ActiveWorkbook.Names.Add Name:="FINAL", RefersToR1C1:= _ "=Analyse!R2C25:R" &amp; comptCandidats &amp; "C25" Sheets("Table").Select Range("M2").Select ActiveCell.FormulaR1C1 = "=COUNTIF(FINAL,RC[-1])" Range("M2").Select Selection.AutoFill Destination:=Range("M2:M19"), Type:=xlFillDefault Range("M2:M19").Select Sheets("Article 19").Select Range("E14").Select ActiveCell.FormulaR1C1 = "=Table!R[-11]C[8]+Table!R[-10]C[8]" Range("E15").Select ActiveCell.FormulaR1C1 = "=Table!R[-9]C[8]" Range("E16").Select ActiveCell.FormulaR1C1 = "=Table!R[-8]C[8]" Range("E17").Select ActiveCell.FormulaR1C1 = "=Table!R[-6]C[8]+Table!R[-5]C[8]+Table!R[-3]C[8]" Range("E18").Select ActiveCell.FormulaR1C1 = "=Table!R[-2]C[8]" Range("E12").Select ActiveCell.FormulaR1C1 = _ "=COUNTIF(FINAL,""&Eacute;tape 2 - PMED du m&ecirc;me groupe de traitement"")+COUNTIF(FINAL,""&Eacute;tape 2 - PMED MESS"")" Range("E13").Select ActiveWindow.SmallScroll Down:=9 Range("E19").Select ActiveCell.FormulaR1C1 = _ "=COUNTIF(FINAL,""&Eacute;tape 8 - Tout autre candidat qualifi&eacute;"")" Range("E20").Select 'Masque colonne non n&eacute;cessaire et copie r&eacute;sultat en valeur &agrave; la colonne A Sheets("Analyse").Select Columns("O:X").Select Selection.EntireColumn.Hidden = True Sheets("Privil&egrave;ge Qual").Select Columns("G:G").Select Selection.EntireColumn.Hidden = True Range("A1:F1").Select Sheets("Analyse").Select Columns("A:A").Select Selection.Insert Shift:=xlToRight Range("A1").Select Columns("Z:Z").Select Selection.Copy Range("A1").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Selection.ColumnWidth = 31.29 Columns("Z:Z").Select Selection.EntireColumn.Hidden = True Range("A1").Select Selection.AutoFilter Selection.Font.Bold = True 'Mise en page de la feuille Analyse pour impression Sheets("Analyse").Select Columns("B:B").ColumnWidth = 9 Columns("D:D").ColumnWidth = 6.29 With ActiveSheet.PageSetup .PrintTitleRows = "$1:$1" .PrintTitleColumns = "" End With ActiveSheet.PageSetup.PrintArea = "" With ActiveSheet.PageSetup .LeftHeader = "" .CenterHeader = "" .RightHeader = "" .LeftFooter = "" .CenterFooter = "" .RightFooter = "" .LeftMargin = Application.InchesToPoints(0.36) .RightMargin = Application.InchesToPoints(0.37) .TopMargin = Application.InchesToPoints(0.53) .BottomMargin = Application.InchesToPoints(0.51) .HeaderMargin = Application.InchesToPoints(0.5) .FooterMargin = Application.InchesToPoints(0.5) .PrintHeadings = False .PrintGridlines = False .PrintComments = xlPrintNoComments .CenterHorizontally = False .CenterVertically = False .Orientation = xlLandscape .Draft = False .FirstPageNumber = xlAutomatic .Order = xlDownThenOver .BlackAndWhite = False .Zoom = 80 .PrintErrors = xlPrintErrorsDisplayed End With 'Redimensionner Colonne Commentaire Columns("AA:AA").Select Selection.ColumnWidth = 27 'Macro Bordures tableau Analyse - Mous With Sheets("Analyse") With .Range("A1").CurrentRegion .VerticalAlignment = xlCenter .ReadingOrder = xlContext For i = 1 To .Borders.Count - 2 With .Borders(i) .LineStyle = xlDot .Weight = xlThin End With Next End With With .Range("A1:" &amp; Cells(1, Columns.Count).End(xlToLeft).Address) .HorizontalAlignment = xlCenter .VerticalAlignment = xlCenter .WrapText = True .ReadingOrder = xlContext End With End With 'enleve les formules de l'onglet anlayse (copie valeur) Sheets("Analyse").Select Columns("P:Z").Select Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Range("Q6").Select Application.CutCopyMode = False 'Positionne le fichier &agrave; l'onglet Article 19 et fait la mise en page pour la pr&eacute;sentation finale Sheets("Article 19").Select Range("C6").Select Selection.ClearContents Range("A1").Select With ActiveSheet.PageSetup .PrintTitleRows = "$1:$10" .PrintTitleColumns = "" End With ActiveSheet.PageSetup.PrintArea = "" With ActiveSheet.PageSetup .LeftMargin = Application.CentimetersToPoints(1) .RightMargin = Application.CentimetersToPoints(1) .TopMargin = Application.CentimetersToPoints(0.5) .BottomMargin = Application.CentimetersToPoints(1) .HeaderMargin = Application.CentimetersToPoints(0.5) .FooterMargin = Application.CentimetersToPoints(0) .PrintTitleRows = "" .Orientation = xlPortrait .FitToPagesWide = 1 .FitToPagesTall = 1 .Zoom = False End With ActiveWindow.DisplayGridlines = False 'Masque les feuilles de travail non n&eacute;cessaire aux intervenants en dotation Sheets("&Eacute;tape R&eacute;ussie").Select ActiveWindow.SelectedSheets.Visible = False Sheets("Admiss ant&eacute;rieure").Select ActiveWindow.SelectedSheets.Visible = False Sheets("Table").Select ActiveWindow.SelectedSheets.Visible = False Sheets("Table PMED").Select ActiveWindow.SelectedSheets.Visible = False Sheets("Article 19").Select Range("E11").Select End Sub</p>

Public Last updated: 2018-04-21 11:43:15 PM