impression, sauts de pages, lignes à répéter en haut.
13 réponses
intactsaphir
Bonjour,
Une feuille de saisie représente un ensemble de tableaux les uns à la suite des autres.
Je souhaiterais en vba:
1) définir la zone d'impression
2) que l'impression de ces données puisse s'effectuer à la suite de sauts de page déterminés par le changement de libellés d'une colonne.
3) que l'impression puisse tenir compte de "lignes à répéter en haut" par exemple les champs de colonnes (AB, champ a, champ b; CD, champ c, champ d).
Sub mispg() Dim L As Long, T As Long, i As Long, Maplage As Range
L = [A65536].End(xlUp).Row T = Range("B" & L).End(xlUp).Row - 1
Do While T > 0
Set Maplage = Range(Cells(L, 1), Cells(T + 2, 9))
With ActiveSheet.PageSetup .PrintArea = Maplage.Address .PrintTitleColumns = Maplage.Columns(1).Address .PrintTitleRows = Range(T & ":" & T + 1).Address .Orientation = xlLandscape End With For i = L To T + 3 Step -1 With Range("a:a") 'avec la colonne If .Cells(i) <> .Cells(i - 1) Then ActiveSheet.HPageBreaks.Add Before:=.Cells(i) End With Next i ActiveSheet.PrintPreview L = T - 1 On Error GoTo fin T = Range("B" & L).End(xlUp).Row - 1 Set Maplage = Nothing Loop fin:
End Sub
merci de votre amabilité Je vais tester ce fichier et je vous en dirai plus demain. Encore merci IC
LSteph a écrit le 09/09/2009 à 15h50 :
Sub mispg()
Dim L As Long, T As Long, i As Long, Maplage As Range
L = [A65536].End(xlUp).Row
T = Range("B" & L).End(xlUp).Row - 1
Do While T > 0
Set Maplage = Range(Cells(L, 1), Cells(T + 2, 9))
With ActiveSheet.PageSetup
.PrintArea = Maplage.Address
.PrintTitleColumns = Maplage.Columns(1).Address
.PrintTitleRows = Range(T & ":" & T + 1).Address
.Orientation = xlLandscape
End With
For i = L To T + 3 Step -1
With Range("a:a") 'avec la colonne
If .Cells(i) <> .Cells(i - 1) Then
ActiveSheet.HPageBreaks.Add Before:=.Cells(i)
End With
Next i
ActiveSheet.PrintPreview
L = T - 1
On Error GoTo fin
T = Range("B" & L).End(xlUp).Row - 1
Set Maplage = Nothing
Loop
fin:
End Sub
merci de votre amabilité
Je vais tester ce fichier et je vous en dirai plus demain.
Encore merci
IC
Sub mispg() Dim L As Long, T As Long, i As Long, Maplage As Range
L = [A65536].End(xlUp).Row T = Range("B" & L).End(xlUp).Row - 1
Do While T > 0
Set Maplage = Range(Cells(L, 1), Cells(T + 2, 9))
With ActiveSheet.PageSetup .PrintArea = Maplage.Address .PrintTitleColumns = Maplage.Columns(1).Address .PrintTitleRows = Range(T & ":" & T + 1).Address .Orientation = xlLandscape End With For i = L To T + 3 Step -1 With Range("a:a") 'avec la colonne If .Cells(i) <> .Cells(i - 1) Then ActiveSheet.HPageBreaks.Add Before:=.Cells(i) End With Next i ActiveSheet.PrintPreview L = T - 1 On Error GoTo fin T = Range("B" & L).End(xlUp).Row - 1 Set Maplage = Nothing Loop fin:
End Sub
merci de votre amabilité Je vais tester ce fichier et je vous en dirai plus demain. Encore merci IC
intactsaphir
intactsaphir a écrit le 09/09/2009 à 16h32 :
LSteph a écrit le 09/09/2009 à 15h50 :
Sub mispg() Dim L As Long, T As Long, i As Long, Maplage As Range
L = [A65536].End(xlUp).Row T = Range("B" & L).End(xlUp).Row - 1
Do While T > 0
Set Maplage = Range(Cells(L, 1), Cells(T + 2, 9))
With ActiveSheet.PageSetup .PrintArea = Maplage.Address .PrintTitleColumns = Maplage.Columns(1).Address .PrintTitleRows = Range(T & ":" & T + 1).Address .Orientation = xlLandscape End With For i = L To T + 3 Step -1 With Range("a:a") 'avec la colonne If .Cells(i) <> .Cells(i - 1) Then ActiveSheet.HPageBreaks.Add Before:=.Cells(i) End With Next i ActiveSheet.PrintPreview L = T - 1 On Error GoTo fin T = Range("B" & L).End(xlUp).Row - 1 Set Maplage = Nothing Loop fin:
End Sub
merci de votre amabilité Je vais tester ce fichier et je vous en dirai plus demain. Encore merci IC
Bonjour LSteph
Le test est excellent..
Merci pour tout.
IS
intactsaphir a écrit le 09/09/2009 à 16h32 :
LSteph a écrit le 09/09/2009 à 15h50 :
Sub mispg()
Dim L As Long, T As Long, i As Long, Maplage As Range
L = [A65536].End(xlUp).Row
T = Range("B" & L).End(xlUp).Row - 1
Do While T > 0
Set Maplage = Range(Cells(L, 1), Cells(T + 2, 9))
With ActiveSheet.PageSetup
.PrintArea = Maplage.Address
.PrintTitleColumns = Maplage.Columns(1).Address
.PrintTitleRows = Range(T & ":" & T + 1).Address
.Orientation = xlLandscape
End With
For i = L To T + 3 Step -1
With Range("a:a") 'avec la colonne
If .Cells(i) <> .Cells(i - 1) Then
ActiveSheet.HPageBreaks.Add Before:=.Cells(i)
End With
Next i
ActiveSheet.PrintPreview
L = T - 1
On Error GoTo fin
T = Range("B" & L).End(xlUp).Row - 1
Set Maplage = Nothing
Loop
fin:
End Sub
merci de votre amabilité
Je vais tester ce fichier et je vous en dirai plus demain.
Encore merci
IC
Sub mispg() Dim L As Long, T As Long, i As Long, Maplage As Range
L = [A65536].End(xlUp).Row T = Range("B" & L).End(xlUp).Row - 1
Do While T > 0
Set Maplage = Range(Cells(L, 1), Cells(T + 2, 9))
With ActiveSheet.PageSetup .PrintArea = Maplage.Address .PrintTitleColumns = Maplage.Columns(1).Address .PrintTitleRows = Range(T & ":" & T + 1).Address .Orientation = xlLandscape End With For i = L To T + 3 Step -1 With Range("a:a") 'avec la colonne If .Cells(i) <> .Cells(i - 1) Then ActiveSheet.HPageBreaks.Add Before:=.Cells(i) End With Next i ActiveSheet.PrintPreview L = T - 1 On Error GoTo fin T = Range("B" & L).End(xlUp).Row - 1 Set Maplage = Nothing Loop fin:
End Sub
merci de votre amabilité Je vais tester ce fichier et je vous en dirai plus demain. Encore merci IC
Bonjour LSteph
Le test est excellent..
Merci pour tout.
IS
LSteph
Bonjour,
Donc pour la procedure d'impression, remplacer le printpreview par printout
Cordialement.
-- lSteph
On 10 sep, 09:11, intactsaphir wrote:
intactsaphir a écrit le 09/09/2009 à 16h32 :
> LSteph a écrit le 09/09/2009 à 15h50 : >> Sub mispg() >> Dim L As Long, T As Long, i As Long, Maplage As Range
>> L = [A65536].End(xlUp).Row >> T = Range("B" & L).End(xlUp).Row - 1
>> Do While T > 0
>> Set Maplage = Range(Cells(L, 1), Cells(T + 2, 9))
>> With ActiveSheet.PageSetup >> .PrintArea = Maplage.Address >> .PrintTitleColumns = Maplage.Columns(1).Address >> .PrintTitleRows = Range(T & ":" & T + 1).Address >> .Orientation = xlLandscape >> End With >> For i = L To T + 3 Step -1 >> With Range("a:a") 'avec la colonne >> If .Cells(i) <> .Cells(i - 1) Then >> ActiveSheet.HPageBreaks.Add Before:=.Cells(i) >> End With >> Next i >> ActiveSheet.PrintPreview >> L = T - 1 >> On Error GoTo fin >> T = Range("B" & L).End(xlUp).Row - 1 >> Set Maplage = Nothing >> Loop >> fin:
>> End Sub
> merci de votre amabilité > Je vais tester ce fichier et je vous en dirai plus demain. > Encore merci > IC
Bonjour LSteph
Le test est excellent..
Merci pour tout.
IS- Masquer le texte des messages précédents -
- Afficher le texte des messages précédents -
Bonjour,
Donc pour la procedure d'impression, remplacer le printpreview par
printout
Cordialement.
--
lSteph
On 10 sep, 09:11, intactsaphir <intactsap...@domain-xyz.in> wrote:
intactsaphir a écrit le 09/09/2009 à 16h32 :
> LSteph a écrit le 09/09/2009 à 15h50 :
>> Sub mispg()
>> Dim L As Long, T As Long, i As Long, Maplage As Range
>> L = [A65536].End(xlUp).Row
>> T = Range("B" & L).End(xlUp).Row - 1
>> Do While T > 0
>> Set Maplage = Range(Cells(L, 1), Cells(T + 2, 9))
>> With ActiveSheet.PageSetup
>> .PrintArea = Maplage.Address
>> .PrintTitleColumns = Maplage.Columns(1).Address
>> .PrintTitleRows = Range(T & ":" & T + 1).Address
>> .Orientation = xlLandscape
>> End With
>> For i = L To T + 3 Step -1
>> With Range("a:a") 'avec la colonne
>> If .Cells(i) <> .Cells(i - 1) Then
>> ActiveSheet.HPageBreaks.Add Before:=.Cells(i)
>> End With
>> Next i
>> ActiveSheet.PrintPreview
>> L = T - 1
>> On Error GoTo fin
>> T = Range("B" & L).End(xlUp).Row - 1
>> Set Maplage = Nothing
>> Loop
>> fin:
>> End Sub
> merci de votre amabilité
> Je vais tester ce fichier et je vous en dirai plus demain.
> Encore merci
> IC
Donc pour la procedure d'impression, remplacer le printpreview par printout
Cordialement.
-- lSteph
On 10 sep, 09:11, intactsaphir wrote:
intactsaphir a écrit le 09/09/2009 à 16h32 :
> LSteph a écrit le 09/09/2009 à 15h50 : >> Sub mispg() >> Dim L As Long, T As Long, i As Long, Maplage As Range
>> L = [A65536].End(xlUp).Row >> T = Range("B" & L).End(xlUp).Row - 1
>> Do While T > 0
>> Set Maplage = Range(Cells(L, 1), Cells(T + 2, 9))
>> With ActiveSheet.PageSetup >> .PrintArea = Maplage.Address >> .PrintTitleColumns = Maplage.Columns(1).Address >> .PrintTitleRows = Range(T & ":" & T + 1).Address >> .Orientation = xlLandscape >> End With >> For i = L To T + 3 Step -1 >> With Range("a:a") 'avec la colonne >> If .Cells(i) <> .Cells(i - 1) Then >> ActiveSheet.HPageBreaks.Add Before:=.Cells(i) >> End With >> Next i >> ActiveSheet.PrintPreview >> L = T - 1 >> On Error GoTo fin >> T = Range("B" & L).End(xlUp).Row - 1 >> Set Maplage = Nothing >> Loop >> fin:
>> End Sub
> merci de votre amabilité > Je vais tester ce fichier et je vous en dirai plus demain. > Encore merci > IC