Mike808
New Member
SO, earlier in the week, I was getting help in this forum with a problem I had on my trendlines for my dashboard. Hui figured it out for the most part, with one last issue:
I need the trendlines to remain no matter what I do with the slicers. Right now the VBA code turns the trendlines off when I change the slicer filters.....this I don't want. Once I run the macro, I want the trendlines to remain on the charts until I manually shut them off via the chart elements checkbox.
A link to my dashboard is:
https://www.dropbox.com/s/c51adklb9ywe6p6/Master Dashboard_09132016.xlsm?dl=0
I created a module and entered this code:
Then on Sheet 7 (my charts sheet) I entered this code:
Thanks for any help anyone could provide!! I have been hitting my head since Wednesday!
Mike808
I need the trendlines to remain no matter what I do with the slicers. Right now the VBA code turns the trendlines off when I change the slicer filters.....this I don't want. Once I run the macro, I want the trendlines to remain on the charts until I manually shut them off via the chart elements checkbox.
A link to my dashboard is:
https://www.dropbox.com/s/c51adklb9ywe6p6/Master Dashboard_09132016.xlsm?dl=0
I created a module and entered this code:
Code:
Sub AddTrendLine()Dim mySeriesCol As SeriesCollectionDim i AsLong, j AsInteger
ThisWorkbook.Sheets(7).Activate
If ActiveSheet.ChartObjects.Count > 0 Then
For i = 1 To ActiveSheet.ChartObjects.Count
ActiveSheet.ChartObjects(i).Select
OnErrorResumeNext
Set mySeriesCol = ActiveSheet.ChartObjects(i).Chart.SeriesCollection
For j = 1 To mySeriesCol.Count
If mySeriesCol(j).Trendlines.Count = 0 Then mySeriesCol(j).Trendlines.Add
Next j
Next I
EndIf
Application.CutCopyMode = False
EndSub
Then on Sheet 7 (my charts sheet) I entered this code:
Code:
PrivateSub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)Call AddTrendLineEndSub
Thanks for any help anyone could provide!! I have been hitting my head since Wednesday!
Mike808