XL 2016 impression par semaine

lamho27

XLDnaute Occasionnel
Bonjour le forum
j'ai un calendrier avec 6 semaine ; je voudrais impression soit semaine par semaine soit page entier
merci d'avance
j'ai un macro pour impression par semaine ; c'est bon pour 1er semaine, mais 2eme semaine il imprime semaines 1et 2
code
Sub Impression()
'
Dim Sem, i As Integer
'
Sem = InputBox("Numéro semaine?")


If Sem = 1 Then
i = 0

Else
i = (Sem - 1) * 7

End If

Range("A" & (6 + i) & ":" & "Z" & (12 + i)).Select
Selection.PrintOut Copies:=1, Collate:=True


End Sub
 

Pièces jointes

  • Classeur3.xlsx
    40.3 KB · Affichages: 60
Dernière édition:

Yurperqod

XLDnaute Occasionnel
Bonjour le forum

Une macro testée avec Excel 2010.
VB:
Sub Impression()
Dim Sem, Cell_SEM As Range
Sem = InputBox("Numéro semaine?")
Set Cell_SEM = Columns(5).Find(What:=Sem, After:=Cells(4, 5), LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows)
ActiveSheet.PageSetup.PrintArea = Cells(Cell_SEM.Row, 1).Resize(10, 27).Address
Application.PrintCommunication = False
    With ActiveSheet.PageSetup
        .LeftMargin = Application.InchesToPoints(0)
        .RightMargin = Application.InchesToPoints(0)
        .TopMargin = Application.InchesToPoints(0)
        .BottomMargin = Application.InchesToPoints(0)
        .HeaderMargin = Application.InchesToPoints(0)
        .FooterMargin = Application.InchesToPoints(0)
        .CenterHorizontally = True
        .CenterVertically = True
        .Orientation = xlLandscape
        .PaperSize = xlPaperA4
        .FirstPageNumber = xlAutomatic
        .FitToPagesWide = 1
        .FitToPagesTall = 1
    End With
    Application.PrintCommunication = True
ActiveSheet.PrintOut Copies:=1, Collate:=True
End Sub
 

Yurperqod

XLDnaute Occasionnel
Bonjour le forum

Une page contenant tout le calendrier, c'est ça?
La macro a été enregistrée avec l'enregistreur
VB:
Sub Macro1()
Application.PrintCommunication = True
ActiveSheet.PageSetup.PrintArea = "$A$1:$Z$65"
Application.PrintCommunication = False
    With ActiveSheet.PageSetup
        .LeftMargin = Application.InchesToPoints(0)
        .RightMargin = Application.InchesToPoints(0)
        .TopMargin = Application.InchesToPoints(0)
        .BottomMargin = Application.InchesToPoints(0)
        .HeaderMargin = Application.InchesToPoints(0)
        .FooterMargin = Application.InchesToPoints(0)
        .PrintQuality = 600
        .CenterHorizontally = True
        .CenterVertically = True
        .Orientation = xlPortrait
        .Draft = False
        .PaperSize = xlPaperA4
        .FirstPageNumber = xlAutomatic
        .Order = xlDownThenOver
        .BlackAndWhite = False
        .Zoom = False
        .FitToPagesWide = 1
        .FitToPagesTall = 1
    End With
Application.PrintCommunication = True
ActiveSheet.PrintOut Copies:=1, Collate:=True
End Sub
 
Dernière édition:

Discussions similaires

Statistiques des forums

Discussions
312 371
Messages
2 087 707
Membres
103 648
dernier inscrit
mehdi kaddaf