Here's a sample macro to get you started. Select a range and it will
work on that range; select a cell and it will work on the entire current
region of the range, the contiguous range containing data. It makes one
chart for each column in the range, and puts each chart lower than the
last so they don't all overlap.
Sub MakeCharts()
Dim myRange As Range
Dim myChartOb As ChartObject
Dim iColCt As Integer
Dim iColIx As Integer
Dim ht As Integer
Dim wd As Integer
ht = 200 ' Chart height
wd = 275 ' Chart width
If TypeName(Selection) = "Range" Then
If Selection.Cells.Count = 1 Then
Set myRange = Selection.CurrentRegion
Else
Set myRange = Selection
End If
iColCt = myRange.Columns.Count
For iColIx = 1 To iColCt
Set myChartOb = ActiveSheet.ChartObjects.Add _
(myRange.Left + myRange.Width, _
myRange.Top + (iColIx - 1) * ht, wd, ht)
With myChartOb.Chart
.SetSourceData myRange.Columns(iColIx)
' include other embellishments here:
' titles, chart type, series formatting
' fonts, colors, etc.
End With
Next
Else
MsgBox "Select a cell in your target range and try again."
End If
End Sub
- Jon