• Cycling Chart Range for Printing

    From noodnutt@gmail.com@21:1/5 to All on Wed Jan 29 01:33:51 2020
    Hi All

    In-as-much as this relates to the same issue, it is broken into two parts:

    Part .1

    I have the below code, which does exactly what I require of it. What I would like to do is expand it so it cycles thru the range within the Pivot Table.

    The Pivot Table has a Filter on it: Field = "CC" which at the moment means they have to manually select each Cost Centre then hit the button to create/print chart.

    Part .2

    When the chart presents itself on being created, it looks as expected, if you do a manual Print Preview, it shows everything, but! if I leave the code to run to the end ( .PrintPreview ) it only shows the chart and no Vertical, Horizontal Axis or Chart
    Title. Any thoughts on what the go is please:


    Dim myPDsht As Worksheet: Set myPDsht = ThisWorkbook.Sheets("Centre Combo") Dim myPT As PivotTable: Set myPT = myPDsht.PivotTables("Centre_Combo")
    Dim myChart As Shape: Set myChart = myPDsht.Shapes.AddChart
    Dim mySSDRng, myTitle As Range
    Dim Lrow As Long

    With myPDsht
    With myChart.Chart
    .SetSourceData Source:=myPDsht.Range("$A$6", myPDsht.Range("$C" & myPDsht.rows.count).End(xlUp))
    .FullSeriesCollection(1).ChartType = xlLine
    .FullSeriesCollection(1).AxisGroup = 1
    .FullSeriesCollection(2).ChartType = xlLine
    .FullSeriesCollection(2).AxisGroup = 1
    .FullSeriesCollection(2).AxisGroup = 2
    .ShowAllFieldButtons = False
    .Parent.Top = 75
    .Parent.Left = 200
    .Parent.Height = 350
    .Parent.Width = 750
    .SetElement (msoElementChartTitleAboveChart)
    .ChartTitle.Text = myPDsht.Range("$B$4")
    .Axes(xlValue).Select
    .Axes(xlValue).MinimumScale = 0
    .Axes(xlValue).MaximumScale = 350
    .Axes(xlValue).MajorUnit = 20
    .Axes(xlValue).MinorUnit = 10
    '.PrintPreview 'Commented out for the moment
    End With
    End With

    As always

    Thank you for your time and efforts.

    Cheers
    Mark.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From noodnutt@gmail.com@21:1/5 to All on Thu Jan 30 15:41:56 2020
    Hi All

    Please disregard.

    After much trawling, I managed to find a solution that fit.

    Cheers
    Mark.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)