Bonsoir à tous
Dans TCD ci joint je souhaite imprimer les idems "date de livraison" on choisissant la date via un user form ,jusque la pas de probleme
j'ai trouvé un code sur le net d'un site anglais pour l'impression mais j'ai du oublié quelque chose
merci de votre collaboration et bonne soiree
som
Sub imprim()
Dim ws As Worksheet
Dim pt As PivotTable
Dim pi As PivotItem
Dim str As String
Dim rng As Range
Dim c
Set ws = ActiveSheet
Set pt = ws.PivotTables(1)
Set rng = Worksheets("feuil1").Range("A4:A370")
c = UserForm1.DTPicker1
For Each c In rng
Set pi = Nothing
str = c.Value
With pt.PageFields("date de livraison")
On Error Resume Next
Set pi = .PivotItems(str)
On Error GoTo 0
If pi Is Nothing Then
Debug.Print str & " was NOT printed"
Else
.CurrentPage = str
ws.PrintOut Preview:=True
End If
End With
Next c
End Sub
Dans TCD ci joint je souhaite imprimer les idems "date de livraison" on choisissant la date via un user form ,jusque la pas de probleme
j'ai trouvé un code sur le net d'un site anglais pour l'impression mais j'ai du oublié quelque chose
merci de votre collaboration et bonne soiree
som
Sub imprim()
Dim ws As Worksheet
Dim pt As PivotTable
Dim pi As PivotItem
Dim str As String
Dim rng As Range
Dim c
Set ws = ActiveSheet
Set pt = ws.PivotTables(1)
Set rng = Worksheets("feuil1").Range("A4:A370")
c = UserForm1.DTPicker1
For Each c In rng
Set pi = Nothing
str = c.Value
With pt.PageFields("date de livraison")
On Error Resume Next
Set pi = .PivotItems(str)
On Error GoTo 0
If pi Is Nothing Then
Debug.Print str & " was NOT printed"
Else
.CurrentPage = str
ws.PrintOut Preview:=True
End If
End With
Next c
End Sub