Macro zone dynamique d'impression
Bonjour,
J'ai un planning annuel sur lequel j'ai un visuel de l'ensemble de mes plannings.
J'aimerai une macro qui me fasse l'impression par mois, selon le mois que je veux. Le hic est que j'ai des hauteurs qui différent selon le nombre de personnes sur le planning.
Je suis pas très malin en macro...
J'ai par ailleurs créer une zone dynamique nommée "janvier"
=DECALER(RECAP!$D$2;;EQUIV(DATE(RECAP!$B$1;1;1);RECAP!$D$5:$NI$5)-1;NBVAL(RECAP!$B$7:$B$70)+5;31)
J'ai donc par cette formule la plage qui m'interresse.
Ci-dessous vous trouverez le code que j'ai utilisé, qui fonctionne... mais que j'aimerai améliorer en faisant appel à la zone "janvier"
Sub janvier()
'
Range("D2:AH38").Select
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = "$B:$B"
End With
Application.PrintCommunication = True
ActiveSheet.PageSetup.PrintArea = "$D$2:$AH$38"
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0)
.RightMargin = Application.InchesToPoints(0)
.TopMargin = Application.InchesToPoints(0.354330708661417)
.BottomMargin = Application.InchesToPoints(0.354330708661417)
.HeaderMargin = Application.InchesToPoints(0.31496062992126)
.FooterMargin = Application.InchesToPoints(0.31496062992126)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = True
.CenterVertically = True
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
.PrintErrors = xlPrintErrorsDisplayed
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = True
.EvenPage.LeftHeader.Text = ""
.EvenPage.CenterHeader.Text = ""
.EvenPage.RightHeader.Text = ""
.EvenPage.LeftFooter.Text = ""
.EvenPage.CenterFooter.Text = ""
.EvenPage.RightFooter.Text = ""
.FirstPage.LeftHeader.Text = ""
.FirstPage.CenterHeader.Text = ""
.FirstPage.RightHeader.Text = ""
.FirstPage.LeftFooter.Text = ""
.FirstPage.CenterFooter.Text = ""
.FirstPage.RightFooter.Text = ""
End With
Application.PrintCommunication = True
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
IgnorePrintAreas:=False
End Sub
Si le code peut être plus court je prend aussi
Merci d'avance.
Leakim
Salut Leakim,
Essaie ceci :
ActiveSheet.PageSetup.PrintArea = "janvier"
ActiveWindow.SelectedSheets.PrintOut
Cordialement.
bonsoir,
Merci Yvouille je teste demain.
@+
Leakim
Salut,
De quel demain parlais-tu ?
Salut Yvouille,
Désolé pour se mutisme, les jours se suivent et les demains aussi...
Ta proposition fonctionne parfaitement, je te remercie à nouveau.
Bonne journée, à demain... sûrement ou un autre jour
Au plaisir de se croiser.
Leakim