A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
Thanks for all the help Hans. Any help on this much appreciated. I'm trying to set up a list of product buttons and attach a macro to each one that select the product from the slicer and applies the appropriate axes values but the code below won't work.
I created a pivot chart with primary and secondary axes. I have a slicer beside chart that is a list of products. Because the primary axis may be negative in some cases I need to apply different minimum and maximum values for each axis for each product. I tried recording a macro that would run that would A. select the product from the slicer and B. set the appropriate primary and secondary axes min and max settings but when I try to run the macro it won't work correctly, in other words it won't just select 2D Design exclusively and apply axes settings.
Without a macro if I pick another product the axes stay the same as the last product which distorts the display with numbers, especially when negative on primary axis.
Sub TwoD()
'
' TwoD Macro
'
With ActiveWorkbook.SlicerCaches("Slicer_Module112")
.SlicerItems("2D Design").Selected = True
End With
ActiveSheet.ChartObjects("Chart 3").Activate
ActiveChart.Axes(xlValue, xlSecondary).Select
ActiveChart.Axes(xlValue, xlSecondary).MinimumScale = -500
ActiveChart.Axes(xlValue, xlSecondary).MaximumScale = 900
ActiveChart.Axes(xlValue).Select
ActiveChart.Axes(xlValue).MinimumScale = -0.6
End Sub