PDA

View Full Version : Delete some plot area



asdzxc
08-26-2014, 06:46 AM
Lw = Range("b2").End(xlDown).Row
Range("A2:I" & Lw).Select
Set cht1 = ActiveSheet.Shapes.AddChart
cht1.Chart.ChartType = xlLineMarkers
cht1.Chart.Location xlLocationAsNewSheet
ActiveChart.ChartArea.Select
ActiveChart.PlotArea.Select
Dim ValuesArray(), SeriesValues As Variant
Dim Ctr As Integer, TotCtr As Integer
With ActiveChart
For Each x In .SeriesCollection
SeriesValues = x.Values
ReDim Preserve ValuesArray(1 To TotCtr + UBound(SeriesValues))
For Ctr = 1 To UBound(SeriesValues)
ValuesArray(Ctr + TotCtr) = SeriesValues(Ctr)
Next
TotCtr = TotCtr + UBound(SeriesValues)
Next
.Axes(xlValue).MinimumScaleIsAuto = True
.Axes(xlValue).MaximumScaleIsAuto = True
.Axes(xlValue).MinimumScale = Application.Min(ValuesArray)
.Axes(xlValue).MaximumScale = Application.Max(ValuesArray)
ActiveChart.FullSeriesCollection(5).Select
ActiveChart.FullSeriesCollection(2).Delete
ActiveChart.FullSeriesCollection(2).Delete
ActiveChart.FullSeriesCollection(2).Delete
ActiveChart.FullSeriesCollection(2).Delete
ActiveChart.FullSeriesCollection(2).Delete
ActiveChart.FullSeriesCollection(2).Delete
ActiveChart.PlotArea.Select
ActiveChart.FullSeriesCollection(2).Select
ActiveChart.FullSeriesCollection(2).AxisGroup = 2
ActiveChart.ChartArea.Select
ActiveChart.FullSeriesCollection(2).Select
ActiveChart.Legend.Select
Selection.Delete
Application.CommandBars("Format Object").Visible = False
plse add code to the above code so that plot area lelow 30 to be deleted

asdzxc
08-26-2014, 06:57 PM
SLOVED