Sub AddColumnChart()
'Adds a clustered column chart
'to the active sheet
'using the 3 largest series values
'from the specified range
Dim s_vals As Range
Dim add As String
Dim cht As Chart
Set s_vals = ActiveSheet.Range("A1:A16") 'change this line
'to the range
'containing your
'series values
add = "=" & _
LargeAdd(s_vals, 1) & "," & _
LargeAdd(s_vals, 2) & "," & _
LargeAdd(s_vals, 3)
Set cht = ActiveSheet.Shapes.AddChart.Chart
With cht
.ChartType = xlColumnClustered
.SeriesCollection.NewSeries
.SeriesCollection(1).Values = add
End With
End Sub
'--------------------------------------------------------------------------
Private Function LargeAdd(rng As Range, k As Long) As String
'Returns the address
'of the k-th largest value
'in a range
LargeAdd = rng.Parent.Name & "!" & _
rng.Find(WorksheetFunction.Large(rng, k)).Address
End Function