Sub calculateCDF() ' ' caculateCDF Macro ' ' Range("M2").Select Selection.EntireRow.Delete Do While Range("M2").Value < 1 And Not IsEmpty(Range("M2")) Range("M2").Select Selection.EntireRow.Delete Loop If IsEmpty(Range("M2")) Then Exit Sub End If Dim row As Integer row = Range("M2").End(xlDown).row Do While Cells(row, 13).Value < 1 And Not IsEmpty(Cells(row, 13)) And row > 2 Cells(row, 13).Select Selection.EntireRow.Delete Loop Range("O1").Select ActiveCell.FormulaR1C1 = "Range to plot from" Range("O2").Select ActiveCell.FormulaR1C1 = "Number of bins" Range("O3").Select ActiveCell.FormulaR1C1 = "Max of Range" Range("O4").Select ActiveCell.FormulaR1C1 = "Min of Range" Range("O5").Select ActiveCell.FormulaR1C1 = "Bin size" Range("O7").Select ActiveCell.FormulaR1C1 = "Average" Range("O8").Select ActiveCell.FormulaR1C1 = "Variance" Range("O9").Select ActiveCell.FormulaR1C1 = "Standard deviation" Range("Q1").Select ActiveCell.FormulaR1C1 = "wkB/s" Range("R1").Select ActiveCell.FormulaR1C1 = "SR Disk BW CDF" Range("P1").Select ActiveCell.FormulaR1C1 = "H2:H1502" Range("P2").Select ActiveCell.FormulaR1C1 = "50" Range("P3").Select ActiveCell.FormulaR1C1 = "=Max(INDIRECT(R[-2]C))" Range("P4").Select ActiveCell.FormulaR1C1 = "=MIN(INDIRECT(R[-3]C))" Range("P5").Select ActiveCell.FormulaR1C1 = "=(R[-2]C-R[-1]C)/R[-3]C" Range("P7").Select ActiveCell.FormulaR1C1 = "=AVERAGE(INDIRECT(R[-6]C))" Range("P8").Select ActiveCell.FormulaR1C1 = "=VAR(INDIRECT(R[-7]C))" Range("P9").Select ActiveCell.FormulaR1C1 = "=STDEV(INDIRECT(R[-8]C))" Range("Q2").Select ActiveCell.FormulaR1C1 = "=R[2]C[-1]" Range("Q3").Select ActiveCell.FormulaR1C1 = "=R[-1]C+R5C16" Range("Q3").Select Selection.AutoFill Destination:=Range("Q3:Q52"), Type:=xlFillDefault Range("R2").Select ActiveCell.FormulaR1C1 = _ "=IF(RC[-1]>=R3C16,1,PERCENTRANK(INDIRECT(R1C16),RC[-1]))" Range("R2").Select Selection.AutoFill Destination:=Range("R2:R52"), Type:=xlFillDefault ActiveSheet.Shapes.AddChart.Select ActiveChart.SetSourceData Source:=ActiveSheet.Range("$O$1:$R$52") ActiveChart.ChartType = xlLine ActiveChart.SeriesCollection(2).Delete ActiveChart.SeriesCollection(1).Delete ActiveChart.SeriesCollection(1).Delete ActiveChart.SeriesCollection(1).XValues = "='sr151_sdc'!$Q$2:$Q$52" ActiveChart.Legend.Select Selection.Delete ActiveChart.SetElement (msoElementPrimaryCategoryAxisTitleAdjacentToAxis) ActiveChart.ChartTitle.Characters.Text = "SSD SR Disk BW (" & ActiveSheet.Name & ")" ActiveChart.Axes(xlCategory).AxisTitle.Select ActiveChart.Axes(xlCategory).AxisTitle.Characters.Text = "wkB/s" End Sub Sub DrawDiskCDF() For Each persheet In ActiveWorkbook.Sheets sheetname = persheet.Name If sheetname <> "Config" And sheetname <> "requests" And sheetname <> "utilization" And sheetname <> "throughput" Then persheet.Select persheet.Activate calculateCDF End If Next