Problème de définition d'une zone d'impression

dame et roi

XLDnaute Occasionnel
Bonsoir à tous,:)

Je bloque sur un problème. Je souhaite remplacer "AD213" dans toutes les lignes ci dessous du code, par la valeur de la cellule B1 de la feuille "zone" par exemple associé à AD . AD+(valeur de la cellule B1).

Range("a1:AD213").Select
ActiveSheet.PageSetup.PrintArea = "$a$1:$AD$213"
Range("a1").Select
With ActiveSheet.PageSetup
.PrintTitleRows = "$5:$6"
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = "$a$1:$AD$213"
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.196850393700787)
.RightMargin = Application.InchesToPoints(0.196850393700787)
.TopMargin = Application.InchesToPoints(0.275590551181102)
.BottomMargin = Application.InchesToPoints(0.275590551181102)
.HeaderMargin = Application.InchesToPoints(0.196850393700787)
.FooterMargin = Application.InchesToPoints(0.196850393700787)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = -3
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100

End With
ActiveWindow.SelectedSheets.PrintOut Copies:=1

Pouvez vous m'aider svp et l'écrire en code vba pour excel 2003.
Merci par avance.
a bientôt
 

Fred0o

XLDnaute Barbatruc
Re : Problème de définition d'une zone d'impression

Bonsoir Dame et roi,

Le code rectifié :

Code:
Range("a1:AD"[COLOR=blue] & Sheets("zone").[B1][/COLOR]).Select
ActiveSheet.PageSetup.PrintArea = "$a$1:$AD$[COLOR=blue]" & Sheets("zone").[B1][/COLOR]
Range("a1").Select
With ActiveSheet.PageSetup
.PrintTitleRows = "$5:$6"
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = "$a$1:$AD$[COLOR=blue]" & Sheets("zone").[B1][/COLOR]

ça devrait fonctionner.
 

Discussions similaires

Statistiques des forums

Discussions
312 836
Messages
2 092 648
Membres
105 477
dernier inscrit
kyra