Ceci est une page optimisée pour les mobiles. Cliquez sur ce texte pour afficher la vraie page.

XL 2021 Mise en page pour imprimer un fichier trié et filtré

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

Constantin

XLDnaute Occasionnel
Supporter XLD
Bonjour à tous,
Je voudrais réaliser une mise en page d'une extraction de données avec une entête "Left Header, Center Header, Right Footer" et un bas de page "Center Footer=n° de page sur Nb de page, Right Footer = Date du jour au format "dd mm aaaa". Pour les données en bleu, vous pouvez mettre ce que vous voulez, j'adapterai...
C'est le format du Right Footer qui me pose des problèmes parce qu'il affiche au format américain (mmddaa) et je n'arrive pas à changer au format souhaité (dd mm aaaa).
En gros, l'extrait de mon fichier ressemble au document joint.
Merci à celui ou celle qui pourra me désembourber...
Bien à vous tous,
 

Pièces jointes

Solution
Bonjour @Constantin

Je te propose ceci :

VB:
Sub IMPAYES()

Dim ws As Worksheet
Set ws = ActiveSheet

Application.ScreenUpdating = False

' Déprotection
ws.Unprotect

' Mise en page
With ws.PageSetup
    .LeftHeader = "Ass JARDINS FAMILIAUX LAVAL"
    .CenterHeader = "&11 &15IMPAYES"
    .RightHeader = "Tous sites"
    
    .LeftFooter = ""
    .CenterFooter = "Page &P / &N"
    
    '***A tester ces solutions à toi de choisir
    .RightFooter = Format(Date, "[$-fr-FR]dddd dd mmmm yyyy") ' Tu auras ==>  16 février 2026
    'ou bien
    '.RightFooter = Format(Date, "dd/mm/yyyy") ' Tu auras ==>  16/02/2026
    '****
    
    .Orientation = xlLandscape
    .Draft = False
    .Zoom = 100
End With

' Suppression filtres existants si...
J'ai fait un bout de code sur mon fichier, ça marche bien sauf cette fichue date que je n'arrive pas à formater...
Sub IMPAYES()
'
' impayés Macro
'

'
ActiveSheet.Unprotect
With ActiveSheet.PageSetup
.LeftHeader = "Ass JARDINS FAMILIAUX LAVAL"
.CenterHeader = "&11 &15IMPAYES"
.RightHeader = "Tous sites"
.LeftFooter = ""
.CenterFooter = "page &P / &N"
.RightFooter = Date 'Pas au bon format


.Orientation = xlLandscape
.Draft = False
.Zoom = 100
End With

ActiveSheet.Range("$A$1:$CT$450").AutoFilter Field:=5, Criteria1:="<>"
ActiveSheet.Range("$A$1:$CT$450").AutoFilter Field:=15, Criteria1:="="
ActiveWindow.SmallScroll Down:=-129
ActiveSheet.Rows("2:3").Hidden = False
ActiveWindow.SelectedSheets.PrintPreview
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub
 
Bonjour @Constantin

Je te propose ceci :

VB:
Sub IMPAYES()

Dim ws As Worksheet
Set ws = ActiveSheet

Application.ScreenUpdating = False

' Déprotection
ws.Unprotect

' Mise en page
With ws.PageSetup
    .LeftHeader = "Ass JARDINS FAMILIAUX LAVAL"
    .CenterHeader = "&11 &15IMPAYES"
    .RightHeader = "Tous sites"
    
    .LeftFooter = ""
    .CenterFooter = "Page &P / &N"
    
    '***A tester ces solutions à toi de choisir
    .RightFooter = Format(Date, "[$-fr-FR]dddd dd mmmm yyyy") ' Tu auras ==>  16 février 2026
    'ou bien
    '.RightFooter = Format(Date, "dd/mm/yyyy") ' Tu auras ==>  16/02/2026
    '****
    
    .Orientation = xlLandscape
    .Draft = False
    .Zoom = 100
End With

' Suppression filtres existants si besoin
If ws.AutoFilterMode Then ws.AutoFilterMode = False

' Application des filtres
With ws.Range("$A$1:$CT$450")
    .AutoFilter Field:=5, Criteria1:="<>"
    .AutoFilter Field:=15, Criteria1:="="
End With

' Affichage des lignes 2 et 3
ws.Rows("2:3").Hidden = False

' Aperçu avant impression
ws.PrintPreview

' Protection feuille
ws.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True

Application.ScreenUpdating = True
End Sub

Merci de ton retour
 
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD

Discussions similaires

Réponses
10
Affichages
868
M
Réponses
9
Affichages
942
Maikales
M
Réponses
4
Affichages
1 K
D
Réponses
4
Affichages
943
Dudesson
D
L
Réponses
2
Affichages
1 K
Lauranne
L
H
Réponses
6
Affichages
1 K
Horusbk
H
J
Réponses
2
Affichages
1 K
C
Réponses
0
Affichages
1 K
Cerealkiller57
C
Les cookies sont requis pour utiliser ce site. Vous devez les accepter pour continuer à utiliser le site. En savoir plus…