Chart Formatting changes with filter conditions

math123987

New Member
Joined
May 21, 2011
Messages
1
Hi all,
I have an excel workbook with 1 pivot table and 1 chart. In the chart I have set 3 fields as columns chart and one as line type. But whenever I change the filters from no data(when filter values mismatch) to data (matching filter values), the formatting goes and I can see only columns for all fields.
How can I keep the formatting(chart types) even when filter conditions change?
I have excel 2010. I am not finding worksheet_change event in the workbook and I tried typing it but the event is not running. Also I used Workbook_SheetPivotTableAfterValueChange, this is running multiple times.
I used the following codes.
Private Sub Workbook_SheetPivotTableAfterValueChange(ByVal Sh As Object, ByVal TargetPivotTable As PivotTable, ByVal TargetRange As Range)
Call modulemacro1

If Sheet1.Range("E31,E34").Value <> 0 Then
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(1).Select
ActiveChart.SeriesCollection(1).ChartType = xlLine
Else
MsgBox ("No data found")
End If

End Sub
Private Sub worksheet_change(ByVal Target As Range)
Call modulemacro1
If Sheet1.Range("E31,E34").Value <> 0 Then
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(1).Select
ActiveChart.SeriesCollection(1).ChartType = xlLine
Else
MsgBox ("No data found")
End If
End Sub
Can anybody help me so that my chart formatting does not change even after changing the filter conditions.....
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Sounds like some dynamic charting is in order. Post your workbook and let's see what we can do.
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,831
Members
452,946
Latest member
JoseDavid

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top