Article ID: 193248
Article Last Modified on 6/17/2005
C3: D3: Region 1 E3: Region 2 F3: Region 3
C4: Jan D4: 10 E4: 80 F4: 15
C5: Feb D5: 20 E5: 70 F5: 25
C6: Mar D6: 30 E6: 60 F6: 35
C7: Apr D7: 40 E7: 50 F7: 45
C12: Jan D12: 10 E12: 80 F12: 15
C13: Feb D13: 20 E13: 70 F13: 25
C14: Mar D14: 30 E14: 60 F14: 35
C15: Apr D15: 40 E15: 50 F15: 45
Sub CreateChart()
Dim range1 As Range, range2 As Range, ChartRange As Range
' Set variable to contents of the first region to be charted.
Set range1 = Range("c4").CurrentRegion
' Set variable to contents of the second region to be charted.
Set range2 = Range("c12").CurrentRegion
' Set variable to the entire region to be charted.
Set ChartRange = Union(range1, range2)
' Add a new chart to the worksheet.
Charts.Add
With ActiveChart
' Set the type of chart.
.ChartType = xlLineMarkers
' Set the source range for the chart.
.SourceData Source:=ChartRange
.Location Where:=XlLocationAsObject, Name:="Sheet1"
End With
End Sub
Additional query words: XL98
Keywords: kbhowto kbdtacode KB193248