Comment obtenir élèves de chaque salle dans 1 liste séparée en relation M9

Bonsoir le Forum,

S'il vous plaît, quelles sont les formules ou codes qu'il faut programmer pour que lorsque vous cliquez sur l'image de l'imprimante pdf, la feuille soit remplie de la salle 1 à la salle dans la cellule M11 feuille salles et selon le nombre d'élèves dans chaque salle la variable qui est écrite dans la cellule M9,Ainsi, nous obtenons les élèves de chaque salle dans une liste séparée, les élèves de chaque salle d'examen sur une page séparée en pdf

Merci infiniment

15t1.xlsx (28.81 Ko)

Bonjour forum

J'ai pu faire ce travail en enregistrant la macro. Y a-t-il une suggestion pour modifier cet enregistrement afin qu'il soit sous la forme d'un code avec boucle afin que le code soit plus précis et efficace:

M7 feuil examen on trouve:tatal élève

M9 feuil examen on trouve:nb élèves par salle examen

M11 feuil examen on trouve:nb salles examen

imprimer les pages salles examen en pdf Au même endroit que le fichier xlsm path

Sub pdf()
'
' pdf Macro
'

'
    Range("C20").Select
    Sheets("Examen").Select
    Range("H18:H135").Select
    Selection.Copy
    Sheets("temp").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Sheets("Examen").Select
    Range("D18:E135").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("temp").Select
    Range("D20:E20").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Sheets("Examen").Select
    Range("F18:F135").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("temp").Select
    Range("F20").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Application.CutCopyMode = False
    With Selection
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlBottom
        .WrapText = False
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
    Sheets("Examen").Select
    Range("G18:G135").Select
    Selection.Copy
    Sheets("temp").Select
    Range("G20").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Sheets("Examen").Select
    Range("I18:I135").Select
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("temp").Select
    Range("L20").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Range("C19:L19").Select
    Application.CutCopyMode = False
    Selection.AutoFilter
    ActiveSheet.Range("$C$19:$L$137").AutoFilter Field:=10, Criteria1:="1"
    Range("I17").Select
    ActiveCell.FormulaR1C1 = "1"
    Range("C20:I43").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
    Range("H20:I20").Select
    With Selection
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlBottom
        .WrapText = False
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
    Selection.Merge
    Selection.Copy
    Range("H21:I43").Select
    Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
        SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
    Rows("20:43").Select
    Range("A43").Activate
    Selection.RowHeight = 22
    With Selection
        .VerticalAlignment = xlCenter
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
    End With
    Range("A3:K138").Select
    Range("J3").Activate
    Selection.PrintOut Copies:=1, Collate:=True
    Range("G3").Select
    ActiveSheet.Range("$C$19:$L$137").AutoFilter Field:=10, Criteria1:="2"
    Range("I17").Select
    ActiveCell.FormulaR1C1 = "2"
    Application.CutCopyMode = False
    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
    Range("H44:I44").Select
    With Selection
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlBottom
        .WrapText = False
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
    Selection.Merge
    Selection.Copy
    Range("H45:I67").Select
    Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
        SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
    Range("A3:K138").Select
    Range("J3").Activate
    Selection.PrintOut Copies:=1, Collate:=True
    Range("G3").Select
    ActiveSheet.Range("$C$19:$L$137").AutoFilter Field:=10, Criteria1:="3"
    Range("C68:I91").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
    Range("H68:I68").Select
    With Selection
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlBottom
        .WrapText = False
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
    Selection.Merge
    Selection.Copy
    Range("H69:I91").Select
    Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
        SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
    Range("I17").Select
    ActiveCell.FormulaR1C1 = "3"
    Rows("68:91").Select
    Range("A91").Activate
    Selection.RowHeight = 22
    With Selection
        .VerticalAlignment = xlCenter
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
    End With
    Range("A3:K138").Select
    Range("J3").Activate
    Selection.PrintOut Copies:=1, Collate:=True
    Range("G4").Select
    ActiveSheet.Range("$C$19:$L$137").AutoFilter Field:=10, Criteria1:="4"
    Range("C92:I115").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
    Range("H92:I92").Select
    With Selection
        .HorizontalAlignment = xlCenter
        .VerticalAlignment = xlBottom
        .WrapText = False
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
    Selection.Merge
    Selection.Copy
    Range("H93:I115").Select
    Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
        SkipBlanks:=False, Transpose:=False
    Application.CutCopyMode = False
    Range("I17").Select
    ActiveCell.FormulaR1C1 = "4"
    Rows("92:115").Select
    Selection.RowHeight = 22
    With Selection
        .VerticalAlignment = xlCenter
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
    End With
    Range("A3:K115").Select
    Range("J3").Activate
    Selection.PrintOut Copies:=1, Collate:=True
    Range("H5:I5").Select
    ActiveSheet.Range("$C$19:$L$137").AutoFilter Field:=10, Criteria1:="5"
    Range("C116:I137").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
    Range("I17").Select
    ActiveCell.FormulaR1C1 = "5"
    Rows("116:137").Select
    Selection.RowHeight = 22
    With Selection
        .VerticalAlignment = xlCenter
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
    End With
    Range("A3:K138").Select
    Range("J3").Activate
    Selection.PrintOut Copies:=1, Collate:=True
    Sheets("temp").Select
    ActiveWindow.SelectedSheets.Visible = False
    Range("I4").Select
End Sub

Merci beaucoup pour l'attention que vous avez accordée à la lecture de ma demande.

Bonjour hicham2610,

Un essai à mon niveau. Il faut entrer le n° de salle en D2 pour trier les candidats et en appuyant sur le logo PDF ça créé un PDF

4t1.xlsm (36.52 Ko)

Bonsoir fcyspm30,Bonsoir Forum

Merci fcyspm30 pour ton aide

svp si tu veux une explication pour ce code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim li As Integer, lisa As Integer
lisa = 6
Sheets("Examen").Activate
For li = 18 To 200
    If Sheets("Examen").Cells(li, 8) = Sheets("salles").Cells(2, 4) Then
    Sheets("salles").Cells(lisa, 1) = Sheets("Examen").Cells(li, 7) 'n° examen
    Sheets("salles").Cells(lisa, 2) = Sheets("Examen").Cells(li, 4) 'Nom et prénom
    Sheets("salles").Cells(lisa, 3) = Sheets("Examen").Cells(li, 5) 'DN
    Sheets("salles").Cells(lisa, 4) = Sheets("Examen").Cells(li, 6) 'classe
    lisa = lisa + 1
    End If
Next
Sheets("salles").Activate
End Sub

Il reste maintenant imprimer tous les listes avec un code en genre 1 to range ou il ya nb des salles avec boucle

Merci à fcyspm30 et à tous Membres du forum.

Re
L'explication est dans le fichier. Le code peut être amélioré car il est de mon niveau de débutant mais il fonctionne.
Vous voudriez que l'impression créé des PDF à sauvegarder sur le disque dur ou les imprimer directement sur papier?
L'intéret de ma proposition est que vous pouvez entrer les observations feuille par feuille par ordinateur avant de lancer l'impression

1t1.xlsm (36.68 Ko)

Merci fcyspm30 pour votre intérêt et votre réponse

Je souhaite imprimer au format pdf pour que le code soit modulable en fonction du nombre de salles d'examen selon chaque cas

Merci beaucoup

Enfin, j'ai trouvé é que le code précédent fonctionne comme la formule Recherchev

Je prévois un nombre max de lignes de la base de données et l'enregistrement des feuilles dans un dossier. Cela permettra de générer autant de feuilles que vous le voudrez sans pour autant modifier systématiquement le code.

Re,

Voilà j'ai créé une feuille avec les fiches que vous pourrez éditer éventuellement. Pour y accéder soit directement soit de la feuille "Salles" où il y a un bouton. Ensuite c'est très intuitif. Trois boutons un pour effacer les données anciennes, le deuxième pour générer les fiches que vous pouvez éditer notamment pour les observations et le troisième pour les sauvegarder en format PDF. Le dossier d'enregistrement se situera automatiquement là où se situe votre fichier excel. à la fin de l'enregistrement le fichier PDF s'ouvre automatiquement et la vous pouvez éventuellement imprimer toutes les feuilles. Un message vous dira aussi ou se situe le dossier d'enregistrement.

6t1.xlsm (54.10 Ko)
Rechercher des sujets similaires à "comment obtenir eleves chaque salle liste separee relation"