LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.charting
Faye
 
Posts: n/a
Default How to put these two together?

I have a spreadsheet that I want to produce charts from. I know how to
find the addresses of ranges that I want to produce charts for. And I
have the codes to create a chart for one data range in the spreadsheet.
Now, how do I tie them together so that the charts will be created by
one macro?

Addresses of ranges to chart
===============================
Set rStart = Range("A1")
grp = rStart.Value

i = 2
Do While Cells(i - 1, 1) < ""
If Cells(i, 1) < grp Then
Set rng = Range("B1", Cells(i - 1, 4))
MsgBox " Addresses for graphing a " & rng.Address(0, 0)

Set rStart = Cells(i, 1)
grp = rStart.Value
End If
i = i + 1
Sheets("Chart").Select
Loop


Macro for the chart
==============
Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData
Source:=Sheets("Chart").Range(B2:D4), PlotBy:=xlColumns

ActiveChart.SeriesCollection(1).ChartType = xlColumnClustered
ActiveChart.SeriesCollection(1).Name = "=""Maximum"""
ActiveChart.SeriesCollection(2).Name = "=""95th"""
ActiveChart.SeriesCollection(3).Name = "=""5th"""
ActiveChart.SeriesCollection(2).Points(1).ApplyDat aLabels
ShowValue:=True
ActiveChart.SeriesCollection(3).Points(1).ApplyDat aLabels
ShowValue:=True

With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "Employee Survey"
.Axes(xlCategory, xlPrimary).HasTitle = False
.Axes(xlValue, xlPrimary).HasTitle = False
End With

Thanks in advance.

Faye Larson

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"