Imprimer si les lignes sont remplies

nobilis Messages postés 32 Date d'inscription vendredi 11 février 2005 Statut Membre Dernière intervention 21 mars 2005 - 23 févr. 2005 à 08:56
nobilis Messages postés 32 Date d'inscription vendredi 11 février 2005 Statut Membre Dernière intervention 21 mars 2005 - 23 févr. 2005 à 16:57
Bonjour à tous,

Je voudrais imprimer mon tableau d'activités comme suit :
- Imprimer les activités 0 à 10 (c-à-d tableau A5 à Z87)
- Imprimer les activités 11 à 20 si au moins une cellule d'une ligne de C88 à Z187 contient une valeur. Sinon ne pas imprimer les activités 11 à 20.

Merci (ci-dessous ma macro qui ne fonctionne pas :-( )

'Impression 0 à 10 activités


Range("A5:Z87").Select
ActiveWindow.LargeScroll ToRight:=3
ActiveWindow.ScrollColumn = 3
With ActiveSheet.PageSetup
.PrintTitleRows = "$7:$7"
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = "AGENDA"
.RightHeader = ""
.LeftFooter = "Activités 1 à 10"
.CenterFooter = "Page 1"
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.196850393700787)
.RightMargin = Application.InchesToPoints(0.196850393700787)
.TopMargin = Application.InchesToPoints(0.196850393700787)
.BottomMargin = Application.InchesToPoints(0.196850393700787)
.HeaderMargin = Application.InchesToPoints(0.31496062992126)
.FooterMargin = Application.InchesToPoints(0.31496062992126)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = -2
.CenterHorizontally = True
.CenterVertically = True
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
Selection.PrintOut Copies:=1, Collate:=True


'Condition d'impression


For ligne = 88 To 167


valeur_ligne = Range("C88:Z167").Rows(ligne).Value


SngNbVal = Application.CountA(valeur_ligne)
MsgBox (SngNbVal)


If SngNbVal = 0 Then


'Impression 11 à 20 activités


Range("A88:Z167").Select
ActiveWindow.LargeScroll ToRight:=3
ActiveWindow.ScrollColumn = 3
With ActiveSheet.PageSetup
.PrintTitleRows = "$7:$7"
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = "AGENDA"
.RightHeader = ""
.LeftFooter = "Activités 10 à 20"
.CenterFooter = "Page 2"
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.196850393700787)
.RightMargin = Application.InchesToPoints(0.196850393700787)
.TopMargin = Application.InchesToPoints(0.196850393700787)
.BottomMargin = Application.InchesToPoints(0.196850393700787)
.HeaderMargin = Application.InchesToPoints(0.31496062992126)
.FooterMargin = Application.InchesToPoints(0.31496062992126)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = -2
.CenterHorizontally = True
.CenterVertically = True
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
Selection.PrintOut Copies:=1, Collate:=True


End If


Next ligne

1 réponse

nobilis Messages postés 32 Date d'inscription vendredi 11 février 2005 Statut Membre Dernière intervention 21 mars 2005 1
23 févr. 2005 à 16:57
Pas d'idée ?
0
Rejoignez-nous